var jQ = jQuery.noConflict();
jQ(function(){
	//jQ("#headtable_btnzone div").removeClass("other_per").addClass("other_per");
	//jQ("#share_clips").removeClass("other_per").css({"backgroundPosition":"0px 0px"});
	var html="";
	for(var i=2020;i>=1950;i--){
		html+="<option value='"+i+"'>"+i+"</option>";
	}
	jQ("#mouth_fun_view_year").empty().append(html);
	var usertype=eval(jQ("#var_usertype").val());
//	if(usertype==2){
//		jQ("#sharefriendplace").hide();
//	}
	window.scrollTo(0,0);
	analyzeUrl();
	jQ("span.share-title input[name=shareraido]").click(function(){
		var val=eval(jQ(this).val());
		if(val){
			jQ("#share-contactchoose").fadeIn();
		}else{
			jQ("#share-contactchoose").fadeOut();
		}
	});
	
	
	jQ("#viewopt").dialog({
		modal: true,
		bgiframe: true,
		autoOpen: false,
		closeOnEscape:false,
		draggable:false,
		height:200,
		buttons: {
			
			"确定": function() {
				var opt=jQ("#viewopt");
				var triggerfun=opt.data("function");
				opt.trigger(triggerfun);
				opt.removeData("function");
				jQ("#viewopt_p").hide();
				jQ("#viewopt_img").show();
				//activeBtnOnDialog("viewopt",false);
				//jQ(this).dialog('close');
			},
			"取消": function() {
				var viewopt=jQ("#viewopt");
				var triggerfun=jQ("#viewopt").data("function");
				viewopt.unbind(triggerfun);
				viewopt.find("input.eventid").val("");
				viewopt.removeData("function");
				jQ(this).dialog('close');
			}
		},
		close: function() {
			jQ("#viewopt_p").show();
			jQ("#viewopt_img").hide();
		},
		open:function(){
		}
	});
	
});

function analyzeUrl(){
	var uid=getUniqueParameter();
	if(uid==null){
		window.location.href=jQ("#ctxVal").val()+"/myclip/calendar.html";
	}else{
		jQ("#mainshareview").data("visituid",uid);
		loadUserBaseInfo(uid);
		initContacts();
		getUsersShareEventsByMonth(0,0);
	}
}

function loadUserBaseInfo(uid){
	jQ.ajax({
		type: "POST",
		url:"userAjax!loadUserBaseInfo.action",
		data:{
			uid:uid
		},
		success:function(data){
			
			if(jQ('user',data).length<=0){
				alert("出错");
				return;
			}
			var userlogo=jQ('user',data).find("userlogo").text();
			var smalluserlogo=jQ('user',data).find("smalluserlogo").text();
			jQ("#userbiglogo").css({"background":"url(\""+userlogo+"\")"});
			jQ("#userbiglogo").data("smalluserlogo",smalluserlogo);
			
			var usertype=eval(jQ('user',data).find("usertype").text());
			jQ("#userbiglogo").data("usertype",usertype);
			if(usertype==2){
				initCCtext(jQ('user',data));
				return;
			}
			
			var realname=jQ('user',data).find("realname").text();
			var name=jQ('user',data).find("name").text();
			var isuserself=eval(jQ('user',data).find("isuserself").text());
			jQ("#mainshareview").data("visituid",jQ('user',data).attr("uid"));
			var ulobj=jQ("#view_box_title ul.userinfobox");
			var html="";
			html+="<li>";
			var var_usertype=eval(jQ("#var_usertype").val());
			var isfriend=false;
			if(jQ('user',data).attr("uid")>0){
				var visituid=jQ('user',data).attr("uid");
				var isfriend=eval(jQ('user',data).find("relation").text());
				var hasinvite=eval(jQ('user',data).find("hasinvite").text());
				if(isuserself){
					html+="<div id=\"sharetitle\" class=\"sharetitle\" style=\"width: 200px;\">"+realname+"  的主页</div>";
					
				}else{
					if(var_usertype!=2){
						if(isfriend){
							html+="<div id=\"sharetitle\" class=\"sharetitle\" style=\"width: 200px;\">"+realname+"  的主页</div>";
							html+="<button id=\"sharetitlefriendbtn\" class=\"deletefriend\"></button>";
							jQ("#sharetitlefriendbtn").addClass("deletefriend").show().unbind("click").bind("click",{visituid:visituid},deleteFriendFun);
						}else{
							html+="<div id=\"sharetitle\" class=\"sharetitle\" style=\"width: 200px;\">"+name+"  的主页</div>";
							if(hasinvite){
								html+="<button id=\"sharetitlefriendbtn\" class=\"disaddfriend\"></button>";
								jQ("#sharetitlefriendbtn").addClass("disaddfriend").show();
							}else{
								html+="<button id=\"sharetitlefriendbtn\" class=\"addfriend\"></button>";
								jQ("#sharetitlefriendbtn").addClass("addfriend").show().unbind("click").bind("click",{visituid:visituid},addFriend);
							}
						}
					}else{
						html+="<div id=\"sharetitle\" class=\"sharetitle\" style=\"width: 200px;\">"+realname+"  的主页</div>";
					}
				}
			}else{
				isfriend=true;
				html+="<div id=\"sharetitle\" class=\"sharetitle\" style=\"width: 200px;\">"+realname+"  的主页</div>";
			}
			html+="</li>";
			
			if(isfriend||isuserself||var_usertype==2){
				var email=jQ('user',data).find("email").text();
				var mobile=jQ('user',data).find("mobile").text();
				var birth=jQ('user',data).find("birth").text();
				html+="<li class=\"username\" >";
				if(!isuserself)
					html+="<span>备注名：</span><span id=\"userinfomemoname\">"+name+"</span>";
				html+="</li>";
				html+="<li class=\"other\"><span>邮箱：</span><span id=\"userinfoemail\">"+email+"</span></li>";
				html+="<li class=\"other\"><span>手机：</span><span id=\"userinfomobile\">"+mobile+"</span></li>";
				html+="<li class=\"other\"><span>生日：</span><span id=\"userinfobirth\">"+birth+"</span></li>";
					
			}
			ulobj.empty().append(html);
			
			if(jQ("#sharetitlefriendbtn").hasClass("deletefriend")){
				jQ("#sharetitlefriendbtn").unbind("click").bind("click",{visituid:visituid},deleteFriendFun);
			}else if(jQ("#sharetitlefriendbtn").hasClass("addfriend")){
				jQ("#sharetitlefriendbtn").unbind("click").bind("click",{visituid:visituid},addFriend);
			}else if(jQ("#sharetitlefriendbtn").hasClass("disaddfriend")){
				jQ("#sharetitlefriendbtn").unbind("click").bind("click",{visituid:visituid},deleteFriendFun);
			}
		}
	});
}

function initCCtext(userobj){
	var bgurl=userobj.find("bgurl").text();
	var userstatus=userobj.find("userstatus").text();
	var blog=userobj.find("blog").text();
	var name=userobj.find("name").text();
	var issubscribed=eval(userobj.find("issubsribed").text());
	var subscribedcount=eval(userobj.find("subscribedcount").text());
	jQ("#view_box").css("background","url('"+jQ("#ctxVal").val()+"/userdata/"+bgurl+"') no-repeat");
	jQ("#view_box").data("name",name);
	jQ("#view_box_title").addClass("spuser_title");
	jQ("#view_box_user_row").css("top","218px");
	var html="<li style='height:23px;'>";
	html+="<a class='homepage' href='"+blog+"'></a>";
	html+="<div title='订阅人数'><span class='icon'></span><span class='count'>"+subscribedcount+"</span></div>";
	if(issubscribed){
		html+="<a class='unsubscribe'></a>";
	}else{
		html+="<a class='subscribe'></a>";
	}
	html+="</li>";
	html+="<li><span style='padding-left: 2px; width: 280px; float: left; padding-top: 6px;'>"+userstatus+"</span></li>";
	
	jQ("#view_box_title ul.userinfobox").addClass("spuserinfobox").empty().append(html);
	jQ("#view_box_title ul.userinfobox li a.unsubscribe").bind("click",unsubscribe);
	jQ("#view_box_title ul.userinfobox li a.subscribe").bind("click",subscribe);
}

function unsubscribe(){
	var button=jQ(this);
	var name=jQ("#view_box").data("name");
	var uid=eval(jQ("#mainshareview").data("visituid"));
	var obj_box = jQ(this);
	var obj_offset = obj_box.offset();
	var msg_box = jQ("#confirmmsg_box");
	jQ("#msg_box2_content").empty().append("确定不再订阅 <font>"+name+"</font> ?");
	var _top = obj_offset.top - msg_box.outerHeight() +10;
	var _left = obj_offset.left - msg_box.outerHeight()/2;
	msg_box.css({"top":_top+"px","left":_left+"px"}).show();
	msg_box.find("div.msg_note2").animate({top: 20+'px'}, 500,function(){
	});
	jQ("#msg_box_opt a.confirm").unbind("click").bind("click",function(){
		jQ.ajax({
			type:"POST",
			url: "contactAjax!unsubscribeCC.action",
			data:{
				uid:uid
			},
			success:function(data){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					jQ("#confirmmsg_box").find("div.msg_note2").animate({top: 200+'px'},500,function(){
						jQ("#confirmmsg_box").hide();
						button.removeClass().addClass("subscribe");
						button.unbind("click").bind("click",subscribe);
					});
					
				}
			}
		});
	});
	jQ("#msg_box_opt a.cancel").unbind("click").bind("click",function(){
		jQ("#confirmmsg_box").find("div.msg_note2").animate({top: 200+'px'},500,function(){jQ("#msg_box").hide();});
	});
}

function subscribe(){
	var button=jQ(this);
	var uid=eval(jQ("#mainshareview").data("visituid"));
	jQ.ajax({
		type:"POST",
		url: "contactAjax!subscribeCC.action",
		data:{
			uid:uid
		},
		success:function(data){
			var dataObj=eval("("+data+")");//转换为json对象
			if(dataObj.result){
				button.removeClass().addClass("unsubscribe");
				button.unbind("click").bind("click",unsubscribe);
			}
		}
	});
}

function getUsersShareEventsByMonth(yearNum,monthNum){
	jQ("#loadingui").show();
	var uid=eval(jQ("#mainshareview").data("visituid"));
	jQ.ajax({
		type: "POST",
		url:"shareAjax!loadUsersShareByMonth.action",
		data:{
			visituid:uid,
			year:yearNum,
			month:monthNum
		},
		success:function(data){
			
			var todayyear=eval(jQ(data).find("tdyear").text());
			var todaymonth=eval(jQ(data).find("tdmonth").text());
			var todaydate=eval(jQ(data).find("tddate").text());
			
			jQ("#divtodaydetailtime").data("year",todayyear);
			jQ("#divtodaydetailtime").data("month",todaymonth);
			jQ("#divtodaydetailtime").data("date",todaydate);
			
			var year_month=jQ(data).find("year_month").attr("value");
			var year=eval(year_month.split("_")[0]);
			var month=eval(year_month.split("_")[1]);
			jQ("#calendarzonetitle").empty().append(year+"年"+(month+1)+"月");
			
			
			jQ("#calendar_monthcontrolbar").data("currentyear",year);
			jQ("#calendar_monthcontrolbar").data("currentmonth",month);
			jQ("#mouth_fun_view_year option[value='"+year+"']").attr("selected",true);
			jQ("#mouth_fun_view_month option[value='"+(month)+"']").attr("selected",true);
			var firstDateOfMonth=new Date(year,month,1);
			var week2=firstDateOfMonth.getDay();
			var week1=0;
			var startdate=new Date(year,month,1);
			if(week2>week1){
				startdate.setDate(firstDateOfMonth.getDate() -week2);
			}
			
			var endyear,endmonth;
			if(month==11){
				endmonth=0;
				endyear=year+1;
			}else{
				endmonth=month+1;
				endyear=year;
			}
			
			var endDateOfMonth=new Date(endyear,endmonth,1);
			endDateOfMonth.setDate(endDateOfMonth.getDate() -1);
			var week6=6;
			var week5=endDateOfMonth.getDay();
			
			
			var enddate=new Date(endyear,endmonth,1);
			enddate.setDate(enddate.getDate() -1);
			if(week5<week6){
				enddate.setDate(endDateOfMonth.getDate()+ (week6-week5));
			}
			var index=0;
			var tY=eval(jQ("#divtodaydetailtime").data("year"));
			var tM=eval(jQ("#divtodaydetailtime").data("month"));
			var tD=eval(jQ("#divtodaydetailtime").data("date"));
			
			jQ("#detailsharetimetable tr td").attr("index","");
			while(startdate.getTime()<=enddate.getTime()){
				var monthdayObj=jQ("#tdmonth"+index);
				jQ("#tdmonth"+index+" div.eventsign").hide();
				monthdayObj.attr("title",startdate.pattern("yyyy年MM月dd日"));
				var key="month"+startdate.pattern("MMdd");
				monthdayObj.removeClass().attr("classmodel","");
				//monthdayObj.addClass("month"+index);
				monthdayObj.data("date",startdate.getTime());
				var obj=jQ(data).find(key);
				var lunar=new Lunar(startdate);
				var isThisMonth=eval(obj.find("isThisMonth").text());
				var size=eval(obj.find("size").text());
				var isholiday=eval(obj.attr("holiday"));
				var weeknum=eval(obj.find("weeknum").text());
				var weekofmonth=eval(obj.find("weekofmonth").text());
				var weekday=eval(obj.find("weekday").text());
				
				var lunartxt=obj.find("lunartxt").text();
				jQ("#tddetail"+index).removeClass();
				
				if(!isThisMonth){
					monthdayObj.addClass("other").attr("classmodel","other");
					jQ("#tddetail"+index).addClass("other");
				}else{
					if(startdate.getDate()==1){
						monthdayObj.addClass("firstdayofmonth");
					}
				}
				if(isholiday){
					monthdayObj.addClass("holiday");
				}
				if(size>0){
					jQ("#tdmonth"+index+" div.eventsign").show();
				}else{
					jQ("#tdmonth"+index+" div.eventsign").hide();
				}
				jQ("#tdmonth"+index+" div.sun").empty().append(startdate.getDate());
				
				jQ("#tddetail"+index).empty().append(startdate.getDate());
				jQ("#tddetail"+index).attr("index",index);
				jQ("#tddetail"+index).attr("day",formateSmallDetailTime(startdate));
				
				jQ("#tdmonth"+index+" div.lunar").empty().append(lunartxt);
				var year=startdate.getFullYear();
				if(year==tY && startdate.getMonth()==tM && startdate.getDate()==tD){
					monthdayObj.addClass("today").attr("classmodel","today");
				}
				index++;
				startdate.setDate(startdate.getDate() +1);
			}
			
			jQ("#detailsharetimetable").data("index",index);
			if(index==28){
				jQ("#monthlast1").hide();
				jQ("#monthlast2").hide();
				jQ("tr[line=4]").hide();
			}else if(index==35){
				jQ("#monthlast1").show();
				jQ("#monthlast2").hide();
				jQ("tr[line=4]").show();
				jQ("tr[line=5]").hide();
			}else{
				jQ("#monthlast1").show();
				jQ("#monthlast2").show();
				jQ("tr[line=4]").show();
				jQ("tr[line=5]").show();
			}
			if(jQ("td.today").length>0){
				var datetime=eval(jQ("td.today").data("date"));
				var temp=new Date();
				temp.setTime(datetime);
				var year=temp.getFullYear();
				var month=temp.getMonth();
				var date=temp.getDate();
				jQ("td.today").addClass(jQ("td.today").attr("classmodel")+"clickon");
				loadDetailShareevent(year,month,date);
			}else{
				var year=eval(jQ("#calendar_monthcontrolbar").data("currentyear"));
				var month=eval(jQ("#calendar_monthcontrolbar").data("currentmonth"));
				var date=1;
				var tmpmonthdayObj=jQ("td.firstdayofmonth");
				tmpmonthdayObj.addClass(tmpmonthdayObj.attr("classmodel")+"clickon");
				var temp=new Date();
				temp.setFullYear(year);
				temp.setMonth(month);
				temp.setDate(1);
				loadDetailShareevent(year,month,date);
			}
			jQ("#mouth_fun_prevyear").unbind( "click" );
			jQ("#mouth_fun_prevmonth").unbind( "click" );
			jQ("#mouth_fun_nextyear").unbind( "click" );
			jQ("#mouth_fun_nextmonth").unbind( "click" );
			jQ("#mouth_fun_prevyear").one("click",prevYearClick);
			jQ("#mouth_fun_prevmonth").one("click",prevMonthClick);
			jQ("#mouth_fun_nextyear").one("click",nextYearClick);
			jQ("#mouth_fun_nextmonth").one("click",nextMonthClick);
			jQ("#loadingui").hide();
			jQ("tr.monthcontent td").unbind("click").bind("click",function(){
				if(jQ(this).hasClass("clickon")||jQ(this).hasClass("todayclickon")||jQ(this).hasClass("otherclickon")){
					return;
				}else{
					jQ("#loadingui").show();
					jQ("tr.monthcontent td[class$=clickon]").removeClass("clickon").removeClass("todayclickon").removeClass("otherclickon");
					var classname=jQ(this).attr("classmodel");
					jQ(this).addClass(classname+"clickon");
					var datetime=eval(jQ(this).data("date"));
					var temp=new Date();
					temp.setTime(datetime);
					var year=temp.getFullYear();
					var month=temp.getMonth();
					var date=temp.getDate();
					jQ("#loadingui").show();
					loadDetailShareevent(year,month,date);
				}
			});
		}
	});
}


function loadDetailShareevent(year,month,date){
	jQ(window.document).unbind("scroll",listenScroll);
	jQ("#smallcalendar").data("date",date);
	jQ("#smallcalendar").data("month",month);
	jQ("#smallcalendar").data("year",year);
	var uid=jQ("#mainshareview").data("visituid");
	var tmp=year;
	jQ.ajax({
		type: "POST",
		url:"shareAjax!getUsersShareEventsByDay.action",
		data:{
			year:year,
			month:month,
			date:date,
			visituid:eval(uid)
		},
		success:function(data){
			jQ("#todayshare").empty().append(jQ(data).find("firstday").text());
			jQ("#crtclip").nextAll().remove();
			organizeUsersShareEventsData(data);
			setTimeout(function(){
				jQ("#loadingui").hide();
			},1000);
		}
	});
}

function continueLoadUsersShare(){
	jQ(window.document).unbind("scroll",listenScroll);
	var date=eval(jQ("#smallcalendar").data("date"));
	var month=eval(jQ("#smallcalendar").data("month"));
	var year=eval(jQ("#smallcalendar").data("year"));
	var uid=jQ("#mainshareview").data("visituid");
	jQ.ajax({
		type: "POST",
		url:"shareAjax!getUsersShareEventsByDay.action",
		data:{
			year:year,
			month:month,
			date:date,
			visituid:eval(uid),
			needmore:1
		},
		success:function(data){
			organizeUsersShareEventsData(data);
		}
	});
}

function organizeUsersShareEventsData(data){
	var length=jQ(data).find("ClipEvent").length;
	if(length==0){
		removeLoadingLine();
		if(jQ("#crtclip").nextAll().length==0){
			var emptyhtml="";
			for(var i=0;i<5;i++){
				emptyhtml+="<tr class='noline'><td>";
				emptyhtml+="<div class='simple'>";
				if(i==0){
					emptyhtml+="<span class=\"emptytxt\">暂无内容</span>";
				}
				emptyhtml+="</div>";
				emptyhtml+="</td></tr>";
			}
			
			jQ("#crtclip").after(emptyhtml);
		}
		return;
	}else{
		jQ("#crtclip").nextAll("tr.noline").remove();
		removeLoadingLine();
		jQ("tr.lastline").removeClass("lastline");
	}
	var smalluserlogo=jQ("#userbiglogo").data("smalluserlogo");
	var usertype=eval(jQ("#userbiglogo").data("usertype"));
	var currentusertype=eval(jQ("#var_usertype").val());
	var htmljoin="";
	jQ(data).find("ClipEvent").each(function(i){
		
		var obj=jQ(this);
		var processstatus=eval(jQ(obj).find("processstatus").text());//
		var id=eval(jQ(obj).attr("id"));//
		var uid=jQ(obj).find("unameid").text();//
		var title=jQ(obj).find("title").text();//
		var starttime=eval(jQ(obj).find("starttime").text());//
		var eventtype=eval(jQ(obj).find("eventtype").text());//
		var cliptype=eval(jQ(obj).find("cliptype").text());//
		var uname=jQ(obj).find("uname").text();
		var reliedclip=eval(jQ(obj).find("reliedclip").text());
		var isuserself=eval(jQ(obj).find("isuserself").text());
		var eventisinterested=jQ(obj).find("eventisinterested").text();
		var invitetime=jQ(this).find("invitetime").text();
		var hasinvitetime=false;
		if(typeof(invitetime)!='undefined'&&eval(invitetime)>0){
			hasinvitetime=true;
			invitetime=eval(invitetime);
		}
//		var timesituation=eval(jQ(obj).find("timesituation").text());
//		var clipusertype=eval(jQ(obj).find("clipusertype").text());
		if(i==length-1)
			htmljoin+= "<tr class='lastline'>";
		else
			htmljoin+="<tr>";
		htmljoin+="<td id='clipevent-"+id+"' class='hasevent'  >";
		if(cliptype==3){
			if(!isuserself&&currentusertype!=2){
				if(eval(eventisinterested))
					htmljoin+="<div class='simple' style='background:#fde9eb;'>";
				else
					htmljoin+="<div class='simple'>";
			}else
				htmljoin+="<div class='simple'>";
		}else
			htmljoin+="<div class='simple'>";
		
		htmljoin+="<span class='head' style=\"background:url('"+smalluserlogo+"');\"><a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"'></a></span>";
		htmljoin+="<span class='name'>";
		var length=getWordsLength(uname,12);
		if(length>100){
			htmljoin+="<a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"' class='maxname' title='"+uname+"'>"+uname+"</a>";
		}else{
			htmljoin+="<a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"'  title='"+uname+"'>"+uname+"</a>";
		}
		if(usertype==2){
			htmljoin+="<span class='v_icon' title='档期认证'></span>";
		}
		htmljoin+="</span>";
		if(hasinvitetime){
			htmljoin+="<span class=\"time\">"+formateDetailTimeWithouthourmin(invitetime)+"</span>";
		}else{
			htmljoin+="<span class=\"time\">"+formateDetailTimeWithouthourmin(starttime)+"</span>";
		}
		if(cliptype==3){
			if(usertype!=2){
				var isconfirmevent=jQ(obj).find("isconfirmevent").text();
				if(typeof(isconfirmevent)!='undefined'&&eval(isconfirmevent)==true){
					htmljoin+="<img class='ce' src=\""+jQ("#ctxVal").val()+"/image/clipmessage_confirmicon.png\" title='一拍即合'></img>";
				}
				htmljoin+="<img  class='ri' src=\""+jQ("#ctxVal").val()+"/image/clipevent_invite.png\" title='活动邀请'></img>";
			}
		}else if(cliptype==4){
			htmljoin+="<img  class='ri' src=\""+jQ("#ctxVal").val()+"/image/clipevent_request.png\" title='求活动'></img>";
		}
		htmljoin+="<span class=\"title\">"+title+"</span>";
		htmljoin+="<span class=\"ocopen\"></span>";
		htmljoin+="</div>";
		htmljoin+="<div class='detail'>";
		htmljoin+="</div>";
		htmljoin+="</td>";
		
		htmljoin+="<div class='ptitle' onclick='myfunc(this)'><div class='"+eventtype+"'></div>"+title+"</div>";
		htmljoin+="</div></td></tr>";
		
		
		
			
	});
	
	jQ("#crtclip").parent().find("tr:last").after(htmljoin);
	jQ(data).find("ClipEvent").each(function(){
		var id=jQ(this).attr("id");
		var isuserself=jQ(this).find("isuserself").text();
		var uname=jQ(this).find("uname").text();
		var unameid=jQ(this).find("unameid").text();
		var unamelogo=jQ(this).find("unamelogo").text();
		var unameslogo=jQ(this).find("unameslogo").text();
		var reliedclip=eval(jQ(this).find("reliedclip").text());
		var cliptype=eval(jQ(this).find("cliptype").text());
		var seid=eval(jQ(this).find("seid").text());
		if(seid>0){
			var sourceeventid=jQ(this).find("sourceeventid").text();
			var sourceuid=eval(jQ(this).find("sourceuid").text());
			var sourceuname=jQ(this).find("sourceuname").text();
			var sourceulogo=jQ(this).find("sourceulogo").text();
			jQ("#clipevent-"+id).data("sourceeventid",sourceeventid);
			jQ("#clipevent-"+id).data("sourceuid",sourceuid);
			jQ("#clipevent-"+id).data("sourceuname",sourceuname);
			jQ("#clipevent-"+id).data("sourceulogo",sourceulogo);
		}
		var shareid=jQ(this).find("shareid").text();
		var title=jQ(this).find("title").text();//
		var starttime=eval(jQ(this).find("starttime").text());
		var endtime=eval(jQ(this).find("endtime").text());
		var iswholeday=eval(jQ(this).find("iswholeday").text());
		var content=jQ(this).find("content").text();
		var clocktime=eval(jQ(this).find("clocktime").text());
		var clipstatus=eval(jQ(this).find("clipstatus").text());
		var eventtype=eval(jQ(this).find("eventtype").text());
		var processstatus=eval(jQ(this).find("processstatus").text());
		var isconfirmevent=eval(jQ(this).find("isconfirmevent").text());
		var eventisinterested=eval(jQ(this).find("eventisinterested").text());
		var clipeventpic=jQ(this).find("clipeventpic").text();
		var isshielded=eval(jQ(this).find("isshielded").text());
		var clipiscc=eval(jQ(this).find("clipiscc").text());
		var invitetime=eval(jQ(this).find("invitetime").text());
		jQ("#clipevent-"+id).data("eventid",id);
		jQ("#clipevent-"+id).data("isuserself",isuserself);
		jQ("#clipevent-"+id).data("uname",uname);
		jQ("#clipevent-"+id).data("unameid",unameid);
		jQ("#clipevent-"+id).data("unamelogo",unamelogo);
		jQ("#clipevent-"+id).data("unameslogo",unameslogo);
		jQ("#clipevent-"+id).data("reliedclip",reliedclip);
		jQ("#clipevent-"+id).data("cliptype",cliptype);
		jQ("#clipevent-"+id).data("seid",seid);
		jQ("#clipevent-"+id).data("shareid",shareid);
		jQ("#clipevent-"+id).data("title",title);
		jQ("#clipevent-"+id).data("starttime",starttime);
		jQ("#clipevent-"+id).data("endtime",endtime);
		jQ("#clipevent-"+id).data("iswholeday",iswholeday);
		jQ("#clipevent-"+id).data("content",content);
		jQ("#clipevent-"+id).data("clocktime",clocktime);
		jQ("#clipevent-"+id).data("clipstatus",clipstatus);
		jQ("#clipevent-"+id).data("eventtype",eventtype);
		jQ("#clipevent-"+id).data("processstatus",processstatus);
		jQ("#clipevent-"+id).data("isconfirmevent",isconfirmevent);
		jQ("#clipevent-"+id).data("eventisinterested",eventisinterested);
		jQ("#clipevent-"+id).data("clipeventpic",clipeventpic);
		jQ("#clipevent-"+id).data("isshielded",isshielded);
		jQ("#clipevent-"+id).data("clipiscc",clipiscc);
		jQ("#clipevent-"+id).data("invitetime",invitetime);
	});
	
	jQ("td.hasevent div.simple span.ocopen").click(function(){
		jQ(this).parent().hide();
		addDetailContent(jQ(this).parent().parent());
		jQ(this).parent().next().fadeIn();
	});
	
	if(length==shareloadlength)
		jQ(window.document).bind("scroll",listenScroll);
}

var shareloadlength=20;
function listenScroll() {
	if(jQ("tr.lastline").length>0){
		var bot = 50;
		if ((bot + jQ(window).scrollTop()) >= (jQ(document).height() - jQ(window).height())) {
			jQ(window.document).unbind("scroll",listenScroll);
			addLoadingLine();
			setTimeout(continueLoadUsersShare,2000);
		}
	}
}

function deleteFriendFun(event){
	var title="删除好友";
	var info="您确定删除该好友么？";
	jQ("#viewopt_visituid").val(event.data.visituid);
	var opt=jQ("#viewopt");
	opt.bind("deleteFriend",deleteFriend);
	opt.data("function","deleteFriend")
	jQ("#viewopt_p").empty().append(info);
	jQ("#viewopt").dialog( "option", "title",title );
	jQ("#viewopt").dialog("open");
}

function deleteFriend(){
	var visituid=jQ("#viewopt_visituid").val();
	jQ.ajax({
		type : "POST",
		url : "contactAjax!delContactByUid.action",
		data :{
			id : visituid
		},
		success:function(data){
			dataObj=eval("("+data+")");
			if(dataObj['flag']){
				jQ("#sharetitlefriendbtn").removeClass().addClass("addfriend");
				jQ("#sharetitlefriendbtn").unbind("click").bind("click",{visituid:visituid},addFriend);
				jQ("#viewopt").dialog("close");
			}else{
				jQ("#viewopt_p").empty().append(dataObj['msg']);
				jQ("#viewopt").dialog("close");
			}
		}
	});
	
}

function addFriend(event){
	var uid=eval(event.data.visituid);
	jQ.ajax({
		type:"POST",
		url: "contactAjax!addAsFriend.action",
		data:{
			id:uid,
			contactType:1
		},
		success:function(data){
			var dataObj=eval("("+data+")");
			if(dataObj['flag']){
				alert("已发送好友邀请");
				jQ("#sharetitlefriendbtn").removeClass().unbind("click").addClass("disaddfriend");
			}
		}
	});
	
}

function addLoadingLine(){
	jQ("tr.lastline").after(jQ("#loadingtr").clone());
}
function removeLoadingLine(){
	jQ("tr.lastline").nextAll().remove();
}

function myfunc(obj){
    var tdobj=jQ(obj).parent().parent();
	if(!tdobj.hasClass("hasevent")){
		jQ("#td_box_detail").hide();
	}else{
		var text = tdobj.text();
		var box = tdobj.offset();
		var color = tdobj.find("div").css("background-color");			
		var b_iw = jQ("table.invite_week").offset();
		var w_iw = jQ("table.invite_week").width();
		var bg_position = b_iw.left + w_iw;
		var box_position = box.left + jQ("#td_box_sharedetail").width();
		if(box_position>bg_position){
			jQ("#td_box_sharedetail").css({"top":box.top-35,"left":bg_position - jQ("#td_box_sharedetail").width(),"min-width":tdobj.width()});
			jQ("#td_box_sharedetail div.detailbox").css({"background-color":color});
		}
		else{
			jQ("#td_box_sharedetail").css({"top":box.top-35,"left":box.left,"min-width":tdobj.width()});
			jQ("#td_box_sharedetail div.detailbox").css({"background-color":color});
		}
		addDetailContent(tdobj);
		/*
		jQ("#td_box_detail div.optdiv a.opt").unbind("click").bind("click",function(){
			jQ("#td_box_detail").hide();
			
			jQ(jQid).find("div").css({backgroundPosition: "0px 0px"});
		});*/
		jQ("#td_box_sharedetail").fadeIn();
		
	}
}

function addDetailContent(tdObj){
	var eventid=jQ(tdObj).data("eventid");
	var cliptype=eval(jQ(tdObj).data("cliptype"));
	var eventtype=eval(jQ(tdObj).data("eventtype"));
	var seid=eval(jQ(tdObj).data("seid"));
	var reliedclip=eval(jQ(tdObj).data("reliedclip"));
	if(cliptype==3){
		var url="";
		if(eventtype==2&&(seid==0||seid==reliedclip)){
			url="eventAjax!getShareCount.action";
		}else{
			url="eventAjax!getInviteCount.action";
		}
		jQ.ajax({
			type: "POST",
			url:url,
			data:{
				eventid:eventid
			},
			success:function(data){
				
				if(data!=null){
					var dataObj=data;//转换为json对象
					_in_addDetailContent(tdObj,dataObj);
				}
			}
		});
	}else{
		if(cliptype==4){
			jQ.ajax({
				type: "POST",
				url:"eventAjax!getRequestCount.action",
				data:{
					eventid:eventid
				},
				success:function(data){
					
					if(data!=null){
						var dataObj=data;//转换为json对象
						_in_addDetailContent(tdObj,dataObj);
					}
				}
			});
		}else
			_in_addDetailContent(tdObj,null);
	}
}

function _in_addDetailContent(liobj,jsonobj){
	
	var id=liobj.attr("id");
	var eventid=jQ(liobj).data("eventid");
	var isuserself=eval(jQ(liobj).data("isuserself"));
	var uname=jQ(liobj).data("uname");
	var unameid=jQ(liobj).data("unameid");
	var unamelogo=jQ(liobj).data("unamelogo");
	var unameslogo=jQ(liobj).data("unameslogo");
	var reliedclip=eval(jQ(liobj).data("reliedclip"));
	var cliptype=eval(jQ(liobj).data("cliptype"));
	var seid=eval(jQ(liobj).data("seid"));
	var shareid=jQ(liobj).data("shareid");
	var title=jQ(liobj).data("title");
	var starttime=jQ(liobj).data("starttime");
	var endtime=jQ(liobj).data("endtime");
	var iswholeday=jQ(liobj).data("iswholeday");
	var content=jQ(liobj).data("content");
	var clocktime=jQ(liobj).data("clocktime");
	var clipstatus=jQ(liobj).data("clipstatus");
	var eventtype=eval(jQ(liobj).data("eventtype"));
	var timesituation=jQ(liobj).data("timesituation");
	var processstatus=jQ(liobj).data("processstatus");
	var isconfirmevent=jQ(liobj).data("isconfirmevent");
	var eventisinterested=jQ(liobj).data("eventisinterested");
	var clipeventpic=jQ(liobj).data("clipeventpic");
	var isshielded=jQ(liobj).data("isshielded");
	var usertype=eval(jQ("#userbiglogo").data("usertype"));
	var currentusertype=eval(jQ("#var_usertype").val());
	var clipiscc=usertype==2;
	
	var invitetime=jQ(liobj).data("invitetime");
	var hasinvitetime=false;
	if(eventtype==2&&typeof(invitetime)!='undefined'&&eval(invitetime)>0){
		hasinvitetime=true;
		invitetime=eval(invitetime);
	}
	
	var usertype=eval(jQ("#userbiglogo").data("usertype"));
	var currentusertype=eval(jQ("#var_usertype").val());
	if(jsonobj!=null)
		jQ(liobj).data("commentcount",jsonobj.commentcount);
	var html="";
	
	html+="<ul class=\"detaillist\">";
	html+="<li class=\"firstline\">";
		html+="<a class=\"userlogo\" href=\""+jQ("#ctxVal").val()+"/myclip/user.html?"+unameid+"\">";
		html+="<img src=\""+unamelogo+"\" width=\"60\"></img>";
		html+="</a>";
		html+="<div class=\"infoandtitle\">";
		html+="<div class=\"info\">";
		html+="<span class=\"name\">";
			html+=uname;
		html+="</span>";
		if(usertype==2)
			html+="<span class=\"v_icon\" title=\"档期认证\"></span>";
		if(cliptype==3){
			if(eventtype==2&&seid==0){
				
			}else{
				html+="<span class=\"source_l\">";
					html+="<i class=\"invite\"></i>";
				html+="</span>";
			}
		}else if(cliptype==4){
			html+="<span class=\"source_l\">";
				html+="<i class=\"request\"></i>";
			html+="</span>";
		}
		if(eventtype==2&&seid>0){
			if(reliedclip!=seid){
				var sourceeventid=jQ(liobj).data("sourceeventid");
				var sourceuid=jQ(liobj).data("sourceuid");
				var sourceuname=jQ(liobj).data("sourceuname");
				var sourceulogo=jQ(liobj).data("sourceulogo");
				html+="<span class=\"source_r\">";
				html+="<span class=\"sourcetitle\">内容来源：</span>";
				html+="<i class=\"sourcelogo\" style=\"background:url('"+sourceulogo+"')\" title=\""+sourceuname+"\"></i>";
				html+="<span class=\"v_icon\" title=\"档期认证\"></span>";
				html+="</span>";
			}
		}
		html+="</div>";
		html+="<div class=\"cliptime\">";
		if(hasinvitetime){
			html+="<span class=\"title\" style='color:#EF3965;'>邀请时间：</span>";
			html+="<span><b style='color:#EF3965;'>"+formateDetailTime(invitetime)+"</b>";
		}else{
			
			html+="<span class=\"title\">活动日期：</span>";
			if(iswholeday){
				if(eventtype==2)
					html+="<span><b> 开始于 </b><b>"+formateDetailTime(starttime)+"</b>";
				else
					html+="<span><b> 开始于 </b><b>"+formateDetailTimeWithouthourmin(starttime)+"</b>";
			}else{
				if(eventtype==2)
					html+="<span><b>"+formateDetailTime(starttime)+"</b><b> - </b><b>"+formateDetailTime(endtime)+"</b>";
				else
					html+="<span><b>"+formateDetailTimeWithouthourmin(starttime)+"</b><b> - </b><b>"+formateDetailTimeWithouthourmin(endtime)+"</b>";
			}
		}
		
		html+="</div>";
		

		html+="</div>";
		html+="</li>";//第一行结束
		if(hasinvitetime){
			html+="<li class=\"secondline\">";
			html+="<div class=\"title\">";
			html+="<span class=\"title\">活动日期：</span>";
			if(iswholeday){
				if(eventtype==2)
					html+="<span><b> 开始于 </b><b>"+formateDetailTime(starttime)+"</b>";
				else
					html+="<span><b> 开始于 </b><b>"+formateDetailTimeWithouthourmin(starttime)+"</b>";
			}else{
				if(eventtype==2)
					html+="<span><b>"+formateDetailTime(starttime)+"</b><b> 至 </b><b>"+formateDetailTime(endtime)+"</b>";
				else
					html+="<span><b>"+formateDetailTimeWithouthourmin(starttime)+"</b><b> 至 </b><b>"+formateDetailTimeWithouthourmin(endtime)+"</b>";
			}
			html+="</div>";	
			html+="</li>";
		}
		html+="<li class=\"secondline\">";
			html+="<div class=\"title\">";
				html+="<span class=\"title\">内容：</span>";
				html+="<span style=\"float: left;float: left;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:280px;\">"+title+"</span>";
				if((reliedclip>0||isuserself==false)&&shareid.length>0){
					html+="<a class=\"opt\"  href='"+jQ("#ctxVal").val()+"/myclip/clip_detail.html?"+shareid+"' >查看详细</a>";
				}else
					html+="<a class=\"opt\" href='"+jQ("#ctxVal").val()+"/myclip/clip_detail.html?eventid="+eventid+"' >查看详细</a>";
			html+="</div>";	
		html+="</li>";
		if((content!=null&&content.length>0)||clipeventpic.length>0){
			html+="<li class='detail' style='height:auto;'>";
				html+="<div class=\"detailcontent\">";
					html+="<span class=\"title\">详情：</span>";
					if(content!=null&&content.length>0)
						html+="<p>"+content+"</p>";
				html+="</div>";
				if(clipeventpic.length>0){
					html+="<div class=\"clippic bigcursor\">";
						html+="<img class='bigcursor' onload='resizeImgCSS(this)' style='display:none;' src='"+jQ("#ctxVal").val()+"/clippic/S_"+clipeventpic+"'>";
					html+="</div>";
				}
			html+="</li>";
		}
		
		
		var userhtml="";
		if(cliptype==3){
			if(eventtype==2&&(seid==0||seid==reliedclip)){
				if(currentusertype!=2){
					var userlist=jsonobj.users;
					userhtml+="<li class=\"last\">";
					userhtml+="<div class=\"top\">";
					userhtml+="</div>";
					userhtml+="<div class=\"arrow_box\">";
					if(typeof(userlist)=='undefined'||userlist.length==0){
						userhtml+="<span class=\"info\">";
						userhtml+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您是否想转给你的好友们看看那？";
						userhtml+="</span>";
					}else{
						userhtml+="<span class=\"info\">";
						userhtml+="感兴趣的好友：";
						userhtml+="</span>";
						userhtml+="<ul style=\"float: left;\">";
						var interestedcount=0;
						for(var i=0;i<userlist.length;i++){
							var userobj=userlist[i];
							var uid=userobj.uid;
							var name=userobj.name;
							var smalllogo=userobj.smalllogo;
							var biglogo=userobj.biglogo;
							userhtml+="<li class=\"iton\" title='"+name+"'>";
							userhtml+="<input type='hidden' class='logo' value=\""+biglogo+"\">";
							userhtml+="<input type='hidden' class='uid' value=\""+uid+"\">";
							userhtml+="<input type='hidden' class='name' value=\""+uid+"\">";
							userhtml+="<a href=\""+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"\" style=\"background:url('"+smalllogo+"')\"></a>";
							userhtml+="</li>";
						}
						userhtml+="</ul>";
					}
					userhtml+="<div class=\"btnline\">";
					userhtml+="<button class=\"forward\" onclick=\"showForwardEvent(this,'"+id+"');\"></button>";
					userhtml+="</div>";
					userhtml+="</div>";
					userhtml+="</li>";
				}
			}else{
				var userlist=jsonobj.users;
				userhtml+="<li class=\"last\">";
				userhtml+="<div class=\"top\">";
				if(isconfirmevent)
					userhtml+="<img src=\""+jQ("#ctxVal").val()+"/image/confirmevent_status.png\" >";
				userhtml+="</div>";
				userhtml+="<div class=\"arrow_box\">";
				userhtml+="<span class=\"info\">";
				if(isconfirmevent)
					userhtml+="参与的好友：";
				else
					userhtml+="邀请的好友：";
				userhtml+="</span>";
				userhtml+="<ul style=\"float: left;\">";
				//加入自己的状态和头像-----------------------------
				if(isuserself==false||reliedclip>0){
					if(eventisinterested){
						userhtml+="<li class=\"iton\" title='我'>";
					}else{
						userhtml+="<li title='我'>";
					}
					userhtml+="<a href=\""+jQ("#ctxVal").val()+"/myclip/user.html?"+jQ("#var_usertype").data("uid")+"\" style=\"background:url('"+jQ("#var_usertype").data("smallurl")+"')\"></a>";
					userhtml+="</li>";
				}
				//加入自己的状态和头像-----------------------------
				var interestedcount=0;
				for(var i=0;i<userlist.length;i++){
					var userobj=userlist[i];
					var uid=userobj.uid;
					var name=userobj.name;
					var smalllogo=userobj.smalllogo;
					var biglogo=userobj.biglogo;
					var tmpeventisinterested=userobj.eventisinterested;
					if(tmpeventisinterested){
						interestedcount++;
						if(isconfirmevent)
							userhtml+="<li class=\"iton\" title='"+name+"'>";
						else
							userhtml+="<li class=\"iton\" title='感兴趣的好友："+name+"'>";
					}else{
						if(isconfirmevent)
							userhtml+="<li title='退出活动的好友："+name+"'>";
						else
							userhtml+="<li title='"+name+"'>";
					}
					userhtml+="<input type='hidden' class='logo' value=\""+biglogo+"\">";
					userhtml+="<input type='hidden' class='uid' value=\""+uid+"\">";
					userhtml+="<input type='hidden' class='name' value=\""+name+"\">";
					userhtml+="<a href=\""+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"\" style=\"background:url('"+smalllogo+"')\"></a>";
					userhtml+="</li>";
				}
				if(!isconfirmevent){
					//if(processstatus==0||processstatus==-1){
						if(reliedclip==0&&isuserself){
							userhtml+="<li class=\"addbtn\">";
							userhtml+="<a onclick='showContactDetailTip(this,"+eventid+");'></a>";
							userhtml+="<span class=\"tip\">继续添加好友，一起同行？</span>";
							userhtml+="</li>";
						}
					//}
				}
				userhtml+="</ul>";
				if(!isconfirmevent){
					//if(processstatus==0||processstatus==-1){
							
						userhtml+="<div class=\"btnline\">";
						if(reliedclip==0&&isuserself){
							if(interestedcount>0)
								userhtml+="<button class=\"confirmevent\" onclick=\"showConfirmEvent(this,'"+id+"');\"></button>";
						}else
							userhtml+="<button class=\"forward\" onclick=\"showForwardEvent(this,'"+id+"');\"></button>";
						userhtml+="</div>";
					//}
				}else{
					//if(processstatus==0||processstatus==-1)
						if(reliedclip>0||!isuserself){
							userhtml+="<div class=\"btnline\">";
							userhtml+="<button class=\"forward\" onclick=\"showForwardEvent(this,'"+id+"');\"></button>";
							userhtml+="</div>";
						}
				}
				userhtml+="</div>";
				userhtml+="</li>";
			}
		}
		html+=userhtml;
		html+="</ul>";
		html+=jQ("#calendarzoneout").clone().html();
		html+="<a class=\"occlose\"></a>";
		
		html+="<div class=\"btnzone\">";
			if(cliptype==3){
				if(eventtype==2&&seid==0&&isuserself){
					var commentcount=jsonobj.commentcount;
					var commentcountstr=commentcount>99999?"99999+":""+commentcount;
					html+="<div class=\"line\">";
					html+="<a class=\"del\">取消档期</a>";
					html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论' count='"+commentcount+"'>评论("+commentcountstr+")</a>";
					html+="</div>";
					html+="<div class=\"line commentline\">";
					html+="<input type=\"text\">";
					html+="<button class=\"commentbtn\" onclick='addNewComment(this);'></button>";
					html+="</div>";
				}else if(eventtype==2&&(seid==0||reliedclip==seid)){
					var isinterest=jsonobj.isinterest;
					var isforward=jsonobj.isforward;
					var isfavor=jsonobj.isfavor;
					var interestcount=jsonobj.interestcount;
					var forwardcount=jsonobj.forwardcount;
					var favorcount=jsonobj.favorcount;
					var commentcount=jsonobj.commentcount;
					liobj.data("eventisinterested",isinterest);
					liobj.data("isforward",isforward);
					liobj.data("isfavor",isfavor);
					liobj.data("interestcount",interestcount);
					liobj.data("forwardcount",forwardcount);
					liobj.data("favorcount",favorcount);
					liobj.data("commentcount",commentcount);
					var commentcountstr=commentcount>99999?"99999+":""+commentcount;
					html+="<div class=\"line\">";
					html+=getInterestBtnHTML(isinterest,interestcount);
					html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论' count='"+commentcount+"'>评论("+commentcountstr+")</a>";
					html+=getFavorBtnHTML(isfavor,favorcount);
					html+="</div>";
					html+="<div class=\"line commentline\">";
					html+="<input type=\"text\">";
					html+="<button class=\"commentbtn\" onclick='addNewComment(this);'></button>";
					html+="</div>";
				}else{
					var commentcount=jsonobj.commentcount;
					var commentcountstr=commentcount>99999?"99999+":""+commentcount;
					html+="<div class=\"line\">";
					if(isuserself&&reliedclip==0){
						html+="<a class=\"del\">取消档期</a>";
					}else{
						if(isconfirmevent){
							html+="<a class='quitclip' title='退出活动'>退出活动</a>";
						}else{
							if(isshielded==false){
								html+=getInterestBtnHTML(isinterest,null);
							}
						}
					}
					if(isuserself||isshielded==false)
						html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论' count='"+commentcount+"'>评论("+commentcountstr+")</a>";
					if(eventisinterested||(isuserself&&reliedclip==0)){
						if(clocktime>0){
							html+="<div class=\"setclock\">";
							html+="<div class=\"middle\">";
							html+="<i class=\"clock\"></i>";
							html+="<span class=\"timedata\">"+formateClockTime(clocktime)+"</span>";
							html+="<a class=\"cancel\"></a>";
							html+="</div>";
							html+="</div>";
						}else{
							html+="<div class=\"setclock\">";
							html+="<div class=\"middle\">";
							html+="<i class=\"clockoff\"></i>";
							html+="<a class=\"timeset\">设置提醒</a>";
							html+="</div>";
							html+="</div>";
						}
					}
					
					if(isshielded){
						html+="<a class='msgclose' title='接收该档期的提示'>接收提示</a>";
					}else{
						if(isuserself&&reliedclip==0){
						}else{
							if(isconfirmevent){
							}else{
								if(eventisinterested==false)
									html+="<a class='msgopen' title='不再接收该档期的提示'>不再提示</a>";
							}
						}
					}
					html+="</div>";
					html+="<div class=\"line commentline\">";
					html+="<input type=\"text\">";
					html+="<button class=\"commentbtn\" onclick='addNewComment(this);' count='"+commentcount+"'></button>";
					html+="</div>";
				}
			}else if(cliptype==4){
				html+="<div class=\"line\">";
				var commentcount=jsonobj.commentcount;
				var commentcountstr=commentcount>99999?"99999+":""+commentcount;
				if(currentusertype!=2){
					if(isuserself){
						html+="<a class=\"del\" title=\"删除该档期\">取消档期</a>";
					}else{
						html+="<a class=\"atta\" title=\"邀请TA一起参与活动\">邀请TA</a>";
					}
				}
				html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论' count='"+commentcount+"'>评论("+commentcountstr+")</a>";
				html+="</div>";
				html+="<div class=\"line commentline\">";
				html+="<input type=\"text\">";
				html+="<button class=\"commentbtn\" onclick='addNewComment(this);'></button>";
				html+="</div>";
			}
			
		html+="</div>";
		liobj.children("div.detail").empty().append(html);
		initDetailTimeCalendar(starttime,iswholeday,endtime,liobj.find("div.detail").find("div.calendarzone"));
		liobj.find("a.occlose").click(function(){
			jQ(this).parent().hide();
			jQ(this).parent().prev().fadeIn();
		});
		liobj.find("div.btnzone div.setclock").find("div.middle a.timeset").unbind("click").bind("click",{liid:liobj.attr("id")},setclockClipevent);
		liobj.find("div.btnzone div.setclock").find("div.middle a.cancel").unbind("click").bind("click",{liid:liobj.attr("id")},cancelClockevent);
		liobj.find("div.btnzone a.del").unbind("click").bind("click",{liid:liobj.attr("id")},delEventNotice);
		liobj.find("div.btnzone a.interest").unbind("click").bind("click",{liid:liobj.attr("id")},uninterestClipevent);
		liobj.find("div.btnzone a.uninterest").unbind("click").bind("click",{liid:liobj.attr("id")},interestClipevent);
		liobj.find("div.btnzone a.comment").unbind("click").bind("click",{liid:liobj.attr("id")},showCommentEvent);
		liobj.find("div.btnzone a.quitclip").unbind("click").bind("click",{liid:liobj.attr("id")},quickClipevent);
		liobj.find("div.btnzone a.msgopen").unbind("click").bind("click",{liid:liobj.attr("id")},shieldClipmessage);
		liobj.find("div.btnzone a.msgclose").unbind("click").bind("click",{liid:liobj.attr("id")},acceptClipmessage);
		liobj.find("div.btnzone a.unfavor").unbind("click").bind("click",{liid:liobj.attr("id")},favorClipevent);
		liobj.find("div.btnzone a.favor").unbind("click").bind("click",{liid:liobj.attr("id")},unfavorClipevent);
		liobj.find("div.btnzone a.atta").unbind("click").bind("click",{liid:liobj.attr("id")},inviteTAClipevent);
		liobj.find("ul.detaillist li.detail").find("div.clippic").unbind("click").bind("click",{liid:liobj.attr("id")},showClipeventpic);
}

function setclockClipevent(event){
	var liobj=jQ("#"+event.data.liid);
	jQ(this).prev().removeClass().addClass("clock");
	jQ(this).hide();
	var html="";
	html+="<input class=\"date\"/>";
	html+="<input class=\"time hour\" value=\"0\"/>";
	html+="<span class=\"time\">时</span>";
	html+="<input class=\"time min\" value=\"0\"/>";
	html+="<span class=\"time\">分</span>";
	html+="<a class=\"confirm\"></a>";
	html+="<a class=\"cancel\"></a>";
	jQ(this).after(html);
	jQ(this).nextAll("input.date").data("liid",event.data.liid);
	jQ(this).nextAll("input.date").datepicker({
		yearRange : '1950:2020',
		dateFormat:'yy-mm-dd',
		changeMonth:true,
		changeYear:true,
		beforeShow: function(i,e){  
			var z = jQuery(i).closest(".ui-dialog").css("z-index") + 4;  
			e.dpDiv.css('z-index', z);
			e.dpDiv.css('font', "14px \"Trebuchet MS\", sans-serif");
		}
    });
	jQ(this).nextAll("input.hour").unbind("blur").bind("blur",hourinput);
	jQ(this).nextAll("input.min").unbind("blur").bind("blur",mininput);
	jQ(this).nextAll("a.cancel").unbind("click").bind("click",function(){
		var clockobj=jQ(this).prevAll("i.clock");
		clockobj.removeClass("clock").addClass("clockoff");
		clockobj.nextAll().remove();
		clockobj.after("<a class=\"timeset\">设置提醒</a>");
		clockobj.nextAll("a.timeset").unbind("click").bind("click",{liid:liobj.attr("id")},setclockClipevent);
		
	});
	jQ(this).nextAll("a.confirm").unbind("click").bind("click",function(){
		var alertdate=jQ(this).prevAll("input.date").datepicker( "getDate" );
		if(alertdate==null||alertdate.length<=0){
			clip_tips("请选择提醒日期。");
			return false;
		}
		var alerthour=eval(jQ("input.hour").val());
		var alertmin=eval(jQ("input.min").val());
		alertdate.setHours(alerthour);
		alertdate.setMinutes(alertmin);
		var alertlong=alertdate.getTime();
		var nowdate=new Date();
		if(alertlong<nowdate){
			clip_tips("提醒的时间应该是将来的时间。");
			return false;
		}
		var clockobj=jQ(this).prevAll("i.clock");
		var liid=jQ(this).prevAll("input.date").data("liid");
		var eventid=jQ("#"+liid).data("eventid");
		jQ.ajax({
			type: "POST",
			url:"eventAjax!addEventClock.action",
			data:{
				eventid:eval(eventid),
				alerttime:alertlong,
				mobilenotice:0
			},
			success:function(data){
				if(data!=null){
					var dataObj=eval("("+data+")");//转换为json对象
					if(dataObj.result){
						var temphtml="";
						temphtml+="<span class=\"timedata\">"+formateClockTime(alertlong)+"</span>";
						temphtml+="<a class=\"cancel\"></a>";
						clockobj.nextAll().remove();
						clockobj.after(temphtml);
						clockobj.nextAll("a.cancel").unbind("click").bind("click",{liid:liid},cancelClockevent);
					}else{
						
					}
				}
			}
		});
	});
	jQ(this).remove();
}

function cancelClockevent(event){
	var liid=event.data.liid;
	var liobj=jQ("#"+liid);
	var eventid=jQ("#"+liid).data("eventid");
	var clockobj=jQ(event.currentTarget).prevAll("i.clock");
	jQ.ajax({
		type: "POST",
		url:"eventAjax!cancelClock.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data.result){
				var temphtml="";
				temphtml+="<a class=\"timeset\">设置提醒</a>";
				clockobj.nextAll().remove();
				clockobj.after(temphtml);
				clockobj.removeClass("clock").addClass("clockoff");
				clockobj.next().unbind("click").bind("click",{liid:liid},setclockClipevent);
			}else{
				
			}
		}
	});
}

function delEventNotice(event){
	var info="您确定要删除当前档期么？";
	var title="删除档期";
	
	var opt=jQ("#viewopt");
	opt.data("liid",event.data.liid);
	opt.bind("delEvent",delEvent);
	opt.data("function","delEvent");
	jQ("#viewopt_p").empty().append(info);
	jQ("#viewopt").dialog("option", "title", title);
	jQ("#viewopt").dialog("open");
	
}

function delEvent(){
	var liobj=jQ("#"+jQ("#viewopt").data("liid"));
	var eventid=eval(liobj.data("eventid"));
	
	jQ.ajax({
		type: "POST",
		url:"eventAjax!deleteEvent.action",
		data:{
			eventid:eventid
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj['result']){
					liobj.parent().remove();
					if(jQ("#crtclip").nextAll().length==0){
						var emptyhtml="";
						for(var i=0;i<5;i++){
							emptyhtml+="<tr class='noline'><td>";
							emptyhtml+="<div class='simple'>";
							if(i==0){
								emptyhtml+="<span class=\"emptytxt\">暂无内容</span>";
							}
							emptyhtml+="</div>";
							emptyhtml+="</td></tr>";
						}
						
						jQ("#crtclip").after(emptyhtml);
					}
					jQ("#viewopt").dialog("close");
				}else{
					
				}
			}
		}
	});
	
}

function interestClipevent(event){
	var liobj=jQ("#"+event.data.liid);
	var eventid=eval(liobj.data("eventid"));
	var btnobj=jQ(this);
	jQ.ajax({
		type: "POST",
		url:"shareAjax!interestShareEvent.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					liobj.data("eventisinterested",1);
					liobj.find("div.simple").css("background","#fde9eb");
					btnobj.removeClass().addClass("interest").attr("title","取消对该档期的感兴趣");
					btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},uninterestClipevent);
					btnobj.parent().find("a.msgopen").remove();
					var eventtype=eval(liobj.data("eventtype"));
					var seid=eval(liobj.data("seid"));
					if(eventtype==2&&seid==0){
						var interestcount=eval(liobj.data("interestcount"));
						interestcount++;
						liobj.data("interestcount",interestcount);
						var interestcountstr=interestcount>99999?"99999+":""+interestcount;
						btnobj.text("取消感兴趣("+interestcountstr+")");
					}else{
						btnobj.text("取消感兴趣");
					}
					
					var temphtml="";
					temphtml+="<div class=\"setclock\">";
					temphtml+="<div class=\"middle\">";
					temphtml+="<i class=\"clockoff\"></i>";
					temphtml+="<a class=\"timeset\">设置提醒</a>";
					temphtml+="</div>";
					temphtml+="</div>";
					btnobj.parent().find("a:last").after(temphtml);
					btnobj.parent().find("div.setclock").find("div.middle a.timeset").unbind("click").bind("click",{liid:liobj.attr("id")},setclockClipevent);
					
					var btnzoneobj=btnobj.parent().parent();
					var ulobj=btnzoneobj.prevAll("ul.detaillist");
					var lilast=ulobj.find("li.last");
					var arrowbox=lilast.find("div.arrow_box");
					var userlistul=arrowbox.find("ul");
					userlistul.find("li:first").addClass("iton");
				}else{
					alert(dataObj.msg);
					window.location.reload();
				}
			}
		}
	});
}

function uninterestClipevent(event){
	var liobj=jQ("#"+event.data.liid);
	var eventid=eval(liobj.data("eventid"));
	var reliedclip=eval(liobj.data("reliedclip"));
	var dealeventid=0;
	if(reliedclip>0)
		dealeventid=reliedclip;
	else
		dealeventid=eventid;
	var btnobj=jQ(this);
	jQ.ajax({
		type: "POST",
		url:"shareAjax!uninterestShareEvent.action",
		data:{
			eventid:dealeventid
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					var eventtype=eval(liobj.data("eventtype"));
					var seid=eval(liobj.data("seid"));
					liobj.find("div.simple").css("background","#ffffff");
					if(eventtype==2&&seid==0){
						liobj.data("eventisinterested",0);
						btnobj.removeClass().addClass("uninterest").attr("title","表示对该档期的感兴趣");
						btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},interestClipevent);
						btnobj.parent().find("div.setclock").remove();
						var interestcount=eval(liobj.data("interestcount"));						
						interestcount--;
						liobj.data("interestcount",interestcount);
						var interestcountstr=interestcount>99999?"99999+":""+interestcount;
						btnobj.text("感兴趣("+interestcountstr+")");
						var btnzoneobj=btnobj.parent().parent();
						var ulobj=btnzoneobj.prevAll("ul.detaillist");
						var lilast=ulobj.find("li.last");
						var arrowbox=lilast.find("div.arrow_box");
						var userlistul=arrowbox.find("ul");
						userlistul.find("li:first").removeClass("iton");
					}else{
						liobj.data("eventisinterested",0);
						btnobj.text("感兴趣");
						btnobj.parent().children("a:last").after("<a title=\"不再提示该档期的提示\" class=\"msgopen\">不再提示</a>");
						btnobj.removeClass().addClass("uninterest").attr("title","表示对该档期的感兴趣");
						btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},interestClipevent);
						btnobj.parent().find("div.setclock").remove();
						var btnzoneobj=btnobj.parent().parent();
						var ulobj=btnzoneobj.prevAll("ul.detaillist");
						var lilast=ulobj.find("li.last");
						var arrowbox=lilast.find("div.arrow_box");
						var userlistul=arrowbox.find("ul");
						userlistul.find("li:first").removeClass("iton");
						btnobj.parent().find("a.msgopen").unbind("click").bind("click",{liid:liobj.attr("id")},shieldClipmessage);
					}
				}else{
					clip_tips(dataObj.msg);
					window.location.reload();
				}
			}
		}
	});
}

function showCommentEvent(event){
	var liobj=jQ("#"+event.data.liid);
	liobj.find("div.detail").find("div.btnzone").find("div.commentline").toggle();
}

function addNewComment(obj){
	var commentlineobj=jQ(obj).parent();
	var btnzoneobj=commentlineobj.parent();
	var detailobj=btnzoneobj.parent();
	var liobj=detailobj.parent();
	var reliedclip=eval(liobj.data("reliedclip"));
	var dealeventid=0;
	if(reliedclip>0){
		dealeventid=reliedclip;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	var replyobj=jQ(obj).prev();
	var content=jQ.trim(replyobj.val());
	if(content==null||content.length==0){
		clip_tips("回复内容不能为空。");
	}else{
		if(content.length>255)
			clip_tips("回复内容不能超过255个字符。"); 
	}
	jQ.ajax({
		type: "POST",
		url:"eventAjax!addreply.action",
		data:{
			eventid:dealeventid,
			content:content
		},
		success:function(data){
			if(data.result){
				btnzoneobj.find("div.commentline").toggle();
				replyobj.val("");
				var firstline=btnzoneobj.find("div:first");
				var commentbtn=firstline.find("a.comment");
				var commentcount=commentbtn.attr("count");
				commentcount++;
				var commentcountstr=commentcount>99999?"99999+":""+commentcount;
				commentbtn.text("评论("+commentcountstr+")");
//				var temphtml="";
//				temphtml+="<a class=\"timeset\">设置提醒</a>";
//				clockobj.nextAll().remove();
//				clockobj.after(temphtml);
//				clockobj.removeClass("clock").addClass("clockoff");
//				clockobj.next().unbind("click").bind("click",{liid:liid},setclockClipevent);
			}else{
				
			}
		}
	});
}

function quickClipevent(event){
	var liobj=jQ("#"+event.data.liid);
	var eventid=eval(liobj.data("eventid"));
	jQ.ajax({
		type: "POST",
		url:"shareAjax!quitClip.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					clip_tips("成功退出活动");
					liobj.parent().remove();
					if(jQ("#crtclip").nextAll().length==0){
						var emptyhtml="";
						for(var i=0;i<5;i++){
							emptyhtml+="<tr class='noline'><td>";
							emptyhtml+="<div class='simple'>";
							if(i==0){
								emptyhtml+="<span class=\"emptytxt\">暂无内容</span>";
							}
							emptyhtml+="</div>";
							emptyhtml+="</td></tr>";
						}
						jQ("#crtclip").after(emptyhtml);
					}
				}else{
					
				}
			}
		}
	});
}

function shieldClipmessage(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var dealeventid=0;
	var reliedclip=eval(liobj.data("reliedclip"));
	if(reliedclip>0){
		dealeventid=reliedclip;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	jQ.ajax({
		type: "POST",
		url:"eventAjax!shieldClipmessage.action",
		data:{
			eventid:eval(dealeventid)
		},
		success:function(data){
			if(data.result){
				btnobj.prevAll().hide();
				liobj.data("isshielded",1);
				btnobj.removeClass().addClass("msgclose").attr("title","接收该档期的提示");
				btnobj.text("接收提示");
				btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},acceptClipmessage);
			}else{
				
			}
		}
	});
}

function acceptClipmessage(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var dealeventid=0;
	var reliedclip=eval(liobj.data("reliedclip"));
	if(reliedclip>0){
		dealeventid=reliedclip;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	jQ.ajax({
		type: "POST",
		url:"eventAjax!acceptClipmessage.action",
		data:{
			eventid:eval(dealeventid)
		},
		success:function(data){
			if(data.result){
				if(btnobj.prevAll("a").length<=0){
					var commentcount=eval(liobj.data("commentcount"));
					var commentcountstr=commentcount>99999?"99999+":""+commentcount;
					var html="";
					html+="<a class='uninterest' title='表示对该档期的感兴趣'>感兴趣</a>";
					html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论'>评论("+commentcountstr+")</a>";
					btnobj.before(html);
					btnobj.parent().find("a.uninterest").unbind("click").bind("click",{liid:liobj.attr("id")},interestClipevent);
					btnobj.parent().find("a.comment").unbind("click").bind("click",{liid:liobj.attr("id")},showCommentEvent);
				}else
					btnobj.prevAll().show();
				liobj.data("isshielded",0);
				btnobj.removeClass().addClass("msgopen").attr("title","不再接收该档期的提示");
				btnobj.text("不再提示");
				btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},shieldClipmessage);
			}else{
				
			}
		}
	});
}

function favorClipevent(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var dealeventid=0;
	var seid=eval(liobj.data("seid"));
	if(seid>0){
		dealeventid=seid;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	jQ.ajax({
		type: "POST",
		url:"shareAjax!favorShareEvent.action",
		data:{
			eventid:eval(dealeventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					
					var favorcount=liobj.data("favorcount");
					favorcount++;
					liobj.data("favorcount",favorcount);
					var favorcountstr=favorcount>99999?"99999+":""+favorcount;
					btnobj.text("取消喜欢("+favorcountstr+")");
					
					btnobj.removeClass().addClass("favor").attr("title","取消喜欢该档期");
					btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},unfavorClipevent);
				}else{
					
				}
			}
		}
	});
}

function unfavorClipevent(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var dealeventid=0;
	var seid=eval(liobj.data("seid"));
	if(seid>0){
		dealeventid=seid;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	jQ.ajax({
		type: "POST",
		url:"shareAjax!unfavorShareEvent.action",
		data:{
			eventid:eval(dealeventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					var favorcount=liobj.data("favorcount");
					favorcount--;
					liobj.data("favorcount",favorcount);
					var favorcountstr=favorcount>99999?"99999+":""+favorcount;
					btnobj.text("喜欢("+favorcountstr+")");
					
					btnobj.removeClass().addClass("unfavor").attr("title","喜欢该档期");
					btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},favorClipevent);
				}else{
					
				}
			}
		}
	});
}

function inviteTAClipevent(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var unameid=eval(liobj.data("unameid"));
	var date=eval(jQ("#smallcalendar").data("date"));
	var month=eval(jQ("#smallcalendar").data("month"));
	var year=eval(jQ("#smallcalendar").data("year"));
	window.location.href=jQ("#ctxVal").val()+"/myclip/add_clip.html?year="+year+"&month="+(month+1)+"&day="+date+"&invites="+unameid;
}

function showClipeventpic(event){
	var liobj=jQ("#"+event.data.liid);
	var clipeventpic=liobj.data("clipeventpic");
	var target=jQ(event.currentTarget);
	if(target.hasClass("bigcursor")){
		//放大
		target.removeClass("bigcursor").addClass("smallcursor");
		target.find("img").removeClass().addClass("smallcursor");
		target.find("img").hide();
		target.find("img").attr("src",jQ("#ctxVal").val()+"/clippic/"+clipeventpic);
	}else{
		//缩小
		target.removeClass("smallcursor").addClass("bigcursor");
		target.find("img").removeClass().addClass("bigcursor");
		target.find("img").hide();
		target.find("img").attr("src",jQ("#ctxVal").val()+"/clippic/S_"+clipeventpic);
	}
	
}

function showConfirmEvent(obj,liid){
	var btnobj=jQ(obj);
	var ulobj=btnobj.parent().prevAll("ul");
	var itonlist=ulobj.find("li.iton");
	if(itonlist.length<=0){
		clip_tips("暂时还未任何好友表态感兴趣，不能进行一拍即合操作。");
	}else{
		jQ("#inf_interestlist").empty();
		var html="";
		jQ("#inf_interestlist").data("itonlength",itonlist.length);
		if(itonlist.length>15){
			var pagecount=Math.ceil(itonlist.length/15);
			jQ("#inf_interestlist").data("pagecount",pagecount);
			jQ("#inf_interestlist").data("currentpage",0);
			for(var i=0;i<15;i++){
				var logo=jQ(itonlist[i]).find("input.logo").val();
				var uid=jQ(itonlist[i]).find("input.uid").val();
				var name=jQ(itonlist[i]).find("input.name").val();
				html+="<li title=\""+name+"\">";
				html+="<img src=\""+logo+"\"/>"
				html+="</li>";
			}
			jQ("#inf_interest_next").show();
			jQ("#inf_interest_next").unbind("click").bind("click",function(){
				var currentpage=eval(jQ("#inf_interestlist").data("currentpage"));
				var pagecount=eval(jQ("#inf_interestlist").data("pagecount"));
				var itonlength=eval(jQ("#inf_interestlist").data("itonlength"));
				if(currentpage+1>=pagecount){
					jQ(this).hide();
					return;
				}else{
					if(currentpage==0)
						jQ("#inf_interest_prev").show();
					currentpage++;
					var html="";
					for(var i=0;i<15;i++){
						var index=i+15*currentpage;
						if(index==itonlength)
							break;
						var logo=jQ(itonlist[i]).find("input.logo").val();
						var uid=jQ(itonlist[i]).find("input.uid").val();
						var name=jQ(itonlist[i]).find("input.name").val();
						html+="<li title=\""+name+"\">";
						html+="<img src=\""+logo+"\"/>"
						html+="</li>";
					}
					jQ("#inf_interestlist").data("currentpage",currentpage);
					jQ("#inf_interestlist").empty().append(html);
					if(currentpage==pagecount-1){
						jQ(this).hide();
					}
				}
			});
			jQ("#inf_interest_prev").unbind("click").bind("click",function(){
				var currentpage=eval(jQ("#inf_interestlist").data("currentpage"));
				var pagecount=eval(jQ("#inf_interestlist").data("pagecount"));
				var itonlength=eval(jQ("#inf_interestlist").data("itonlength"));
				if(currentpage-1<0){
					jQ(this).hide();
					return;
				}else{
					if(currentpage+1==pagecount)
						jQ("#inf_interest_next").show();
					currentpage--;
					var html="";
					for(var i=0;i<15;i++){
						var index=i+15*currentpage;
						if(index==itonlength)
							break;
						var logo=jQ(itonlist[i]).find("input.logo").val();
						var uid=jQ(itonlist[i]).find("input.uid").val();
						var name=jQ(itonlist[i]).find("input.name").val();
						html+="<li title=\""+name+"\">";
						html+="<img src=\""+logo+"\"/>"
						html+="</li>";
					}
					jQ("#inf_interestlist").data("currentpage",currentpage);
					jQ("#inf_interestlist").empty().append(html);
					if(currentpage==0){
						jQ(this).hide();
					}
						
						
				}
			});
		}else{
			itonlist.each(function(){
				var logo=jQ(this).find("input.logo").val();
				var uid=jQ(this).find("input.uid").val();
				var name=jQ(this).find("input.name").val();
				html+="<li title=\""+name+"\">";
				html+="<img src=\""+logo+"\"/>"
				html+="</li>";
			});
		}
		
		jQ("#inf_interestlist").append(html);
		var btnoffset=btnobj.offset();
		jQ("#confirmEventInterface").css({"top":btnoffset.top-200,"left":btnoffset.left-360});
		jQ("#inf_interest_confirm").data("eventid",jQ("#"+liid).data("eventid"));
		jQ("#inf_interest_confirm").data("liid",liid);
		jQ("#inf_interest_confirm").unbind("click").bind("click",confirmEventOpt);
		jQ("#confirmEventInterface").show();
	}
}

function confirmEventOpt(){
	var eventid=eval(jQ("#inf_interest_confirm").data("eventid"));
	var liid=jQ("#inf_interest_confirm").data("liid");
	var btnObj=jQ(this);
	jQ.ajax({
		type: "POST",
		url:"eventAjax!confirmEvent.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data.result){
				jQ("#confirmEventInterface").hide();
				jQ("#inf_interestlist").empty();
				var detailobj=jQ("#"+liid).find("div.detail");
				var detaillistobj=detailobj.find("ul.detaillist");
				var lastobj=detaillistobj.find("li.last");
				var topobj=lastobj.find("div.top");
				
				var arrowboxobj=lastobj.find("div.arrow_box");
				topobj.append("<img src=\""+jQ("#ctxVal").val()+"/image/confirmevent_status.png\"></img>");
				arrowboxobj.find("span.info").text("参加的好友：");
				var ulobj=arrowboxobj.find("ul");
				ulobj.find("li[class!='iton']").remove();
				arrowboxobj.find("div.btnline").remove();
			}else{
				
			}
		}
	});
}

function closeConfirm_Inf(){
	jQ("#confirmEventInterface").hide();
	jQ("#inf_interestlist").empty();
	jQ("#inf_interest_confirm").removeData("eventid");
	jQ("#inf_interest_confirm").unbind("click");
}

function showForwardEvent(obj,liid){
	var btnline=jQ(obj).parent();
	if(btnline.nextAll("div.zonecontent").length>0){
		if(btnline.nextAll("div.zonecontent").css("display")=="none"){
			btnline.nextAll("div.zonecontent").show();
		}else{
			btnline.nextAll("div.zonecontent").hide();
		}
		
	}else{
		btnline.after(jQ("#forwardsharepart").clone().html());
		btnline.nextAll("div.zonecontent").attr("id","zone_"+liid);
	}
	
}

/*

function detailEvent(event){
	var tdObj=jQ("#"+event.data.tdObj);
	var eventid=eval(tdObj.data("eventid"));
	var isuserself=eval(jQ(tdObj).data("isuserself"));
	var shareid=jQ(tdObj).data("shareid");
	var cliptype=eval(jQ(tdObj).data("cliptype"));
	var date=eval(jQ("#smallcalendar").data("date"));
	var month=eval(jQ("#smallcalendar").data("month"));
	var year=eval(jQ("#smallcalendar").data("year"));
	var uid=jQ("#mainshareview").data("visituid");
//	jQ.ajax({
//		type: "POST",
//		url:"shareAjax!setUserDetailQuery.action",
//		data:{
//			year:year,
//			month:month,
//			date:date,
//			visituid:uid
//		},
//		success:function(data){
			if(isuserself){
				window.open(jQ("#ctxVal").val()+"/myclip/clip_detail.html?eventid="+eventid);
			}else{
				window.open(jQ("#ctxVal").val()+"/myclip/clip_detail.html?shareid="+shareid);
			}
//		}
//	});
	
}
*/
/*
function saveshareEvent(event){
	var tdObj=jQ("#"+event.data.tdObj);
	var eventid=eval(tdObj.data("eventid"));
	var btnobj=jQ(this);
	jQ.ajax({
		type: "POST",
		url:"shareAjax!saveShareEvent.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					tdObj.data("isaccept",true);
					tdObj.data("acceptshareid",dataObj.shareid);
					var savedeventid=dataObj.eventid;
					invitingOptReturnBox(btnobj,"保存成功");
					btnobj.removeClass("saveshare").addClass("cancelshare");
					btnobj.unbind("click").bind("click",{tdObj:tdObj.attr("id")},cancelshareEvent);
					btnobj.after("<a class=\"forwardshare\"></a>");
					tdObj.find("div.simple").css("background","#fde9eb");
					tdObj.find("div.detail").append(jQ("#shareoutzone").clone());
					initShareoutBtn(tdObj.find("div.detail"));
					tdObj.find("div.btn>a.forwardshare").unbind("click").bind("click",{tdObj:tdObj.attr("id")},forwardshareEvent);
					jQ("#clipevent-"+savedeventid+" div.simple span.ocopen").click(function(){
						jQ(this).parent().hide();
						addDetailContent(jQ(this).parent().parent());
						jQ(this).parent().next().fadeIn();
					});
				}else{
					alert(dataObj.msg);
					window.location.reload();
				}
			}
		}
	});
	
}

function cancelshareEvent(event){
	var tdObj=jQ("#"+event.data.tdObj);
	
	var acceptshareid=tdObj.data("acceptshareid");
	var btnobj=jQ(this);
	jQ.ajax({
		type: "POST",
		url:"shareAjax!cancelShareEvent.action",
		data:{
			shareid:acceptshareid
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					tdObj.data("isaccept",false);
					tdObj.data("acceptshareid","");
					invitingOptReturnBox(btnobj,"取消成功");
					btnobj.removeClass("cancelshare").addClass("saveshare");
					btnobj.unbind("click").bind("click",{tdObj :tdObj.attr("id")},saveshareEvent)
					tdObj.find("div.btn>a.forwardshare").unbind("click").remove();
					tdObj.find("div.simple").css("background","#ffffff");
					tdObj.find("div.detail div.shareoutzone").remove();
				}else{
				}
			}
		}
	});
}

function forwardshareEvent(event){
	var tdObj=event.data.tdObj;
	var btnobj=jQ(this);
	var shareclipzone=btnobj.parent().parent().next();
	shareclipzone.find("div.zonecontent").find("div.share-choose input.sharerd").attr("name",tdObj);
	shareclipzone.find("div.zonecontent").find("div.share-choose input.sharerd:first").attr("checked",true);
	shareclipzone.find("div.contactgrouplist ul").empty().hide();
	var data=jQ("#mainshareview").data("contactgroups");
	var source = jQ( "ContactGroup ", data ).map(function() {
		return {
			label: jQ("groupname", this).text(),
			id: jQ(this).attr("id"),
			membercount: jQ("membercount", this).text(),
			value:jQ("pinyingroupname", this).text()
		};
	}).get();
	shareclipzone.show();
	shareclipzone.find("input.groupnameinput").autocomplete({
		source: source,
		minLength:1,
		select: function( event, ui ) {
			if(ui.item){
				showQuickContactGroup(ui.item.id,ui.item.label,ui.item.membercount,this,null);
			}
		},
		close: function() {
			jQ(this).val("");
		}
	}).data( "autocomplete" )._renderItem = function( ul, item ) {
	return jQ( "<li></li>" )
		.data( "item.autocomplete", item )
		.append( "<a>" + item.label +"</a>" )
		.appendTo( ul );
	};
	
}

function cancelshareclick(obj){
	var choosebtn=jQ(obj).parent();
	var zonecontent=choosebtn.parent();
	zonecontent.hide();
}

function confirmshareclick(obj){
	var btnobj=jQ(obj);
	var contactchoosebtn=jQ(obj).parent();
	var zonecontent=contactchoosebtn.parent();
	var arrow_box=zonecontent.parent();
	var elementliobj=arrow_box.parent();
	var ulobj=elementliobj.parent();
	var detailobj=ulobj.parent();
	var liobj=detailobj.parent();;
	var share_contactchooseout=contactchoosebtn.prevAll("div.share-contactchooseout");
	var listcontent=share_contactchooseout.find("ul.listcontent");
	var templength=listcontent.find("li").length;
	var sharelist='',mlist='';
	if(templength==0){
		clip_tips("请至少选择一名好友。");
		return false;
	}else{
		var tmphtml="";
		var listarr=new Array();
		listcontent.find("li").each(function(i){
			if(i==0)
				tmphtml=jQ(this).find("span.name").attr("uid")
			else{
				tmphtml+=","+jQ(this).find("span.name").attr("uid")
			}
			var mobileobj=jQ("div.opt",this).find("a.mobilemsgonit");
			var flag=mobileobj.length>0;
			if(flag){
				var mobilenotice=mobileobj.data("mobilenotice");
				if(mobilenotice){
					listarr.push(jQ("span.name",this).attr("uid"));
				}
			}
		});
		sharelist=tmphtml;
		mlist=listarr.toString();
	}
	
	var eventid=liobj.data("eventid");
	jQ.ajax({
		type: "POST",
		url:"shareAjax!forwardShareEvent.action",
		data:{
			eventid:eval(eventid),
			share2userlist:sharelist,
			mlist:mlist
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					zonecontent.find("div.add_return").prevAll().hide();
					listcontent.empty();
					btnobj.hide();
					zonecontent.find("div.add_return").show();
					var title=liobj.data("title");
					var beginlong=eval(liobj.data("starttime"));
					initShareOutofSite(zonecontent.find("div.add_return"),dataObj.shareid,title,beginlong);
				}else{
					
				}
			}
		}
	});
	
}
*/

function invitingOptReturnBox(obj,content){
	var obj_box = jQ(obj);
	var obj_offset = obj_box.offset();
	var msg_box = jQ("#msg_box");
	jQ("#msg_box_content").empty().append(content);
	var _top = obj_offset.top - msg_box.outerHeight()/2;
	var _left = obj_offset.left - msg_box.outerHeight()/2;
	msg_box.css({"top":_top+"px","left":_left+"px"}).show();
	msg_box.find("div.msg_note").animate({top: 20+'px'}, 500,function(){
		setTimeout(function(){
			msg_box.find("div.msg_note").animate({top: 100+'px'},500,function(){msg_box.hide();});
		},2000);
	});
}

function initDetailTimeCalendar(starttime,iswholeday,endtime,calendarzoneobj){
	var startdate=new Date();
	startdate.setTime(starttime);
	var year=startdate.getFullYear();
	var month=startdate.getMonth();
	startdate=new Date(year,month,startdate.getDate());
	var enddate;
	var issameday=false;
	if(!iswholeday){
		enddate=new Date();
		enddate.setTime(endtime);
		enddate=new Date(enddate.getFullYear(),enddate.getMonth(),enddate.getDate());
		issameday=startdate.getTime()==enddate.getTime();
	}else{
		issameday=true;
	}
	detailtimemonth(null,startdate,enddate,issameday,year,month,calendarzoneobj);
	calendarzoneobj.show();
}

function detailtimemonth(event,startdate,enddate,issameday,year,month,calendarzoneobj){
	if(typeof(startdate)=='undefined'){
		startdate=event.data.startdate;
		issameday=event.data.issameday;
		enddate=event.data.enddate;
		month=event.data.month;
		year=event.data.year;
		calendarzoneobj=event.data.calendarzoneobj;
	}
	var firstDateOfMonth=new Date(year,month,1);
	var title=firstDateOfMonth.pattern("yyyy年MM月");
	calendarzoneobj.find("div.title span.title").empty().append(title);
	var week2=firstDateOfMonth.getDay();
	var week1=0;
	var startfromdate=new Date(year,month,1);
	if(week2>week1){
		startfromdate.setDate(firstDateOfMonth.getDate() -week2);
	}
	var endyear,endmonth;
	if(month==11){
		endmonth=0;
		endyear=year+1;
	}else{
		endmonth=month+1;
		endyear=year;
	}
	
	var endDateOfMonth=new Date(endyear,endmonth,1);
	endDateOfMonth.setDate(endDateOfMonth.getDate() -1);
	var week6=6;
	var week5=endDateOfMonth.getDay();
	
	
	var endtodate=new Date(endyear,endmonth,1);
	endtodate.setDate(endtodate.getDate() -1);
	if(week5<week6){
		endtodate.setDate(endDateOfMonth.getDate()+ (week6-week5));
	}
	var index=0;
	
	while(startfromdate.getTime()<=endtodate.getTime()){
		var tdobj=calendarzoneobj.find("td[tid=tddetail"+index+"]");
		tdobj.empty().append(startfromdate.getDate());
		tdobj.removeClass();
		if(startfromdate.getMonth()!=firstDateOfMonth.getMonth(0)){
			if(!issameday){
				if(startfromdate.getTime()>=startdate.getTime()&&startfromdate.getTime()<enddate.getTime()+1){
					tdobj.addClass("selected");
				}else{
					tdobj.addClass("other");
				}
			}else{
				tdobj.addClass("other");
			}
		}else{
			if(issameday){
				if(startfromdate.getTime()==startdate.getTime()){
					tdobj.addClass("selected");
				}
			}else{
				if(startfromdate.getTime()>=startdate.getTime()&&startfromdate.getTime()<enddate.getTime()+1){
					tdobj.addClass("selected");
				}
			}
		}
		index++;
		startfromdate.setDate(startfromdate.getDate() +1);
	}
	if(index==28){
		calendarzoneobj.find("tr[line=4]").hide();
	}else if(index==35){
		calendarzoneobj.find("tr[line=4]").show();
		calendarzoneobj.find("tr[line=5]").hide();
	}else{
		calendarzoneobj.find("tr[line=4]").show();
		calendarzoneobj.find("tr[line=5]").show();
	}
	
	if(issameday){
		calendarzoneobj.find("div.title a").addClass("none");
	}else{
		if(startdate.getTime()<firstDateOfMonth.getTime()){
			var temp1=new Date(firstDateOfMonth.getFullYear(),firstDateOfMonth.getMonth(),firstDateOfMonth.getDate());
			temp1.setMonth(temp1.getMonth()-1);
			var tempyear=temp1.getFullYear();
			var tempmonth=temp1.getMonth();
			calendarzoneobj.find("div.title a.prev").removeClass("none").unbind("click")
				.bind("click",{startdate:startdate,enddate:enddate,issameday:issameday,year:tempyear,month:tempmonth,calendarzoneobj:calendarzoneobj},detailtimemonth);
		}else{
			calendarzoneobj.find("div.title a.prev").addClass("none").unbind("click");
		}
		var tempdate=new Date(endDateOfMonth.getFullYear(),endDateOfMonth.getMonth(),endDateOfMonth.getDate());
		tempdate.setDate(tempdate.getDate()+ 1);
		if(enddate.getTime()>tempdate.getTime()){
			var tempyear=tempdate.getFullYear();
			var tempmonth=tempdate.getMonth();
			calendarzoneobj.find("div.title a.next").removeClass("none").unbind("click")
			.bind("click",{startdate:startdate,enddate:enddate,issameday:issameday,year:tempyear,month:tempmonth,calendarzoneobj:calendarzoneobj},detailtimemonth);
		}else{
			calendarzoneobj.find("div.title a.next").addClass("none").unbind("click");
		}
	}
}
/*
function initShareoutBtn(detailobj){
	var liobj=detailobj.parent();
	detailobj.find("a.renrenlogo").unbind("click").bind("click",function(){
		var isuserself=eval(jQ(liobj).data("isuserself"));
		var title=jQ(liobj).data("title");
		var starttime=jQ(liobj).data("starttime");
		var shareid;
		if(isuserself){
			shareid=jQ(liobj).data("shareid");
		}else{
			shareid=jQ(liobj).data("acceptshareid");
		}
		var day=new Date();
		day.setTime(starttime);
		var startstr=day.pattern("yyyy年MM月dd日");
		
		
		var url="http://"+document.domain+jQ("#ctxVal").val()+"/myclip/clip_detail.html?shareid="+shareid;
		window.open(
		'http://www.connect.renren.com/share/sharer?url='+url
		+'&title=档期分享：'+startstr+'  '+title+'    '+'更多详情请点击',
		'_blank',
		'height=290,width=510,top=200,left=430,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no'); 
	});
	detailobj.find("a.kaixin001logo").unbind("click").bind("click",function(){
		var isuserself=eval(jQ(liobj).data("isuserself"));
		var title=jQ(liobj).data("title");
		var starttime=jQ(liobj).data("starttime");
		var shareid;
		if(isuserself){
			shareid=jQ(liobj).data("shareid");
		}else{
			shareid=jQ(liobj).data("acceptshareid");
		}
		var day=new Date();
		day.setTime(starttime);
		var startstr=day.pattern("yyyy年MM月dd日");
		var url="http://"+document.domain+jQ("#ctxVal").val()+"/myclip/clip_detail.html?shareid="+shareid;
		window.open(
		'http://www.kaixin001.com/repaste/share.php?rurl='+url
		+'&rtitle=档期分享'
		+'&rcontent='+startstr+'  '+title+'    '+'更多详情请点击',
		'_blank',
		'height=500,width=700,top=200,left=410,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no');
	});
	detailobj.find("a.sinalogo").unbind("click").bind("click",function(){
		var isuserself=eval(jQ(liobj).data("isuserself"));
		var title=jQ(liobj).data("title");
		var starttime=jQ(liobj).data("starttime");
		var shareid;
		if(isuserself){
			shareid=jQ(liobj).data("shareid");
		}else{
			shareid=jQ(liobj).data("acceptshareid");
		}
		var day=new Date();
		day.setTime(starttime);
		var startstr=day.pattern("yyyy年MM月dd日");
		var url="http://"+document.domain+jQ("#ctxVal").val()+"/myclip/clip_detail.html?shareid="+shareid;
		var param = {
		    url:url,
		    type:'3',
		    title:'档期分享：'+startstr+'  '+title+'    '+'更多详情请点击',
		    pic:'',
		    ralateUid:'2618696840',
			language:'zh_cn',
		    rnd:new Date().valueOf()
		  }
		var temp = [];
		for( var p in param ){
			temp.push(p + '=' + encodeURIComponent( param[p] || '' ) )
		}
		
		window.open(
				'http://service.weibo.com/share/share.php?' + temp.join('&') ,
				'_blank',
		'height=520,width=607,top=150,left=410,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no');
	});
	detailobj.find("a.doubanlogo").unbind("click").bind("click",function(){
		var isuserself=eval(jQ(liobj).data("isuserself"));
		var title=jQ(liobj).data("title");
		var starttime=jQ(liobj).data("starttime");
		var shareid;
		if(isuserself){
			shareid=jQ(liobj).data("shareid");
		}else{
			shareid=jQ(liobj).data("acceptshareid");
		}
		var day=new Date();
		day.setTime(starttime);
		var startstr=day.pattern("yyyy年MM月dd日");
		var url="http://"+document.domain+jQ("#ctxVal").val()+"/myclip/clip_detail.html?shareid="+shareid;
		window.open(
		'http://www.douban.com/recommend/?url='+url
		+'&title=档期分享'+
		+'&comment='+startstr+'  '+title+'    '+'更多详情请点击',
		'_blank',
		'height=370,width=505,top=300,left=450,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no');
	});
}
*/

/*
function sloadAllDetailShareevent(contacttype){
	var type=contacttype;
	jQ.ajax({
		type: "POST",
		url:"shareAjax!getviewShareEventsByDay.action",
		data:{
			contacttype:contacttype
		},
		success:function(data){
			if(type==0)
				organizeviewShareEventsData(data);
			else
				organizeviewfriend_ShareEventsData(data);
		}
	});
}

function organizeviewShareEventsData(data){
	var htmljoin="";
	jQ(data).find("ShareEvent").each(function(i){
		var id=jQ(this).attr("id");
		var uid=jQ(this).find("uid").text();
		var eventtype=jQ(this).find("eventtype").text();
		var title=jQ(this).find("title").text();
		var uname=jQ(this).find("uname").text();
		var starttime=eval(jQ(this).find("starttime").text());
		var userlogo=jQ(this).find("userlogo").text();
		var shareid=jQ(this).find("shareid").text();
		var isuserself=eval(jQ(this).find("isuserself").text());
		if(i>2)
			htmljoin+="<tr linenum='"+i+"' style='display:none;' class='scrollline'>";
		else
			htmljoin+="<tr linenum='"+i+"' class='scrollline'>";
		htmljoin+="<td alleventid='clipevent-"+id+"' class='event' shareid='"+shareid+"' isuserself="+isuserself+">";
		htmljoin+="<div class='event '>";
		htmljoin+="<div class='head' style=\"background:url('"+userlogo+"')\"><a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"'></a></div>";
		htmljoin+="<div class='spname'><span class='name'>"+uname+"</span><span class='time' title='开始时间'>"+formateDetailTimeWithhourmin(starttime)+"</span></div>";
		htmljoin+="<div class='sptitle'>"+title+"</div>";
		htmljoin+="</div></td></tr>";
		
	});
	jQ("#smallsharetr").nextAll().remove();
	jQ("#smallsharetr").after(htmljoin);
	jQ("tr.scrollline").click(function(){
		var isuserself=eval(jQ(this).find("td").attr("isuserself"));
		var url="";
		if(isuserself){
			var alleventid=jQ(this).find("td").attr("alleventid");
			var eventid=alleventid.split("-")[1];
			url=jQ("#ctxVal").val()+"/myclip/clip_detail.html?eventid="+eventid;
		}else{
			var shareid=jQ(this).find("td").attr("shareid");
			url=jQ("#ctxVal").val()+"/myclip/clip_detail.html?shareid="+shareid;
		}
		window.location.href=url;
	});
	if(jQ(data).find("ShareEvent").length>3){
		jQ("#smallsharetr").data("max",jQ(data).find("ShareEvent").length);
		jQ("#smallsharetr").data("cur",0);
		jQ("#smallsharetr").data("round",false);
		jQ("tr.scrollline").mouseover(function(){
			clearInterval(scrolllinefun);
		});
		jQ("tr.scrollline").mouseout(function(){
			clearInterval(scrolllinefun);
			scrolllinefun=setInterval(scrollline,5000);
		});
		
		scrolllinefun=setInterval(scrollline,5000);
	}
}

var scrolllinefun=null;

function scrollline(){
	
	var max=eval(jQ("#smallsharetr").data("max"));
	var cur=eval(jQ("#smallsharetr").data("cur"));
	var isround=eval(jQ("#smallsharetr").data("round"));
	jQ("tr.scrollline[linenum=" + cur + "]").fadeOut('slow',function(){
		if(!isround){
			if (cur < max - 3) {
				var temp = cur + 3;
				jQ("tr.scrollline[linenum=" + temp + "]").fadeIn('normal');
			}else{
				isround=true;
				jQ("#smallsharetr").data("round",true);
				var temp=cur+3-max;
				var obj=jQ("tr.scrollline[linenum="+temp+"]").clone(true);
				jQ("tr.scrollline[linenum="+temp+"]").remove();
				jQ("#smallsharetable tr:last").after(obj);
				obj.fadeIn('normal');
			}
		}else{
			var temp;
			if (cur < max - 3) 
				temp=cur+3;
			else
			temp=cur+3-max;
			var obj=jQ("tr.scrollline[linenum="+temp+"]").clone(true);
			jQ("tr.scrollline[linenum="+temp+"]").remove();
			jQ("#smallsharetable tr:last").after(obj);
			obj.fadeIn('normal');
		}
		cur++;
		if(cur==max)
			cur=0;
		jQ("#smallsharetr").data("cur",cur);
	});
}

var fscrolllinefun=null;
function organizeviewfriend_ShareEventsData(data){
	var htmljoin="";
	jQ(data).find("ShareEvent").each(function(i){
		var id=jQ(this).attr("id");
		var uid=jQ(this).find("uid").text();
		var eventtype=jQ(this).find("eventtype").text();
		var title=jQ(this).find("title").text();
		var uname=jQ(this).find("uname").text();
		var starttime=eval(jQ(this).find("starttime").text());
		var userlogo=jQ(this).find("userlogo").text();
		var shareid=jQ(this).find("shareid").text();
		var isuserself=eval(jQ(this).find("isuserself").text());
		if(i>2)
			htmljoin+="<tr linenum='"+i+"' style='display:none;' class='fscrollline'>";
		else
			htmljoin+="<tr linenum='"+i+"' class='fscrollline'>";
		htmljoin+="<td alleventid='clipevent-"+id+"' class='event' shareid='"+shareid+"' isuserself="+isuserself+">";
		htmljoin+="<div class='event '>";
		htmljoin+="<div class='head' style=\"background:url('"+userlogo+"')\"><a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"'></a></div>";
		htmljoin+="<div class='spname'><span class='name'>"+uname+"</span><span class='time' title='开始时间'>"+formateDetailTimeWithhourmin(starttime)+"</span></div>";
		htmljoin+="<div class='sptitle'>"+title+"</div>";
		htmljoin+="</div></td></tr>";
		
	});
	jQ("#friend_smallsharetr").nextAll().remove();
	jQ("#friend_smallsharetr").after(htmljoin);
	jQ("tr.scrollline").click(function(){
		var isuserself=eval(jQ(this).find("td").attr("isuserself"));
		var url="";
		if(isuserself){
			var alleventid=jQ(this).find("td").attr("alleventid");
			var eventid=alleventid.split("-")[1];
			url=jQ("#ctxVal").val()+"/myclip/clip_detail.html?eventid="+eventid;
		}else{
			var shareid=jQ(this).find("td").attr("shareid");
			url=jQ("#ctxVal").val()+"/myclip/clip_detail.html?shareid="+shareid;
		}
		window.location.href=url;
	});
	if(jQ(data).find("ShareEvent").length>3){
		jQ("#friend_smallsharetr").data("max",jQ(data).find("ShareEvent").length);
		jQ("#friend_smallsharetr").data("cur",0);
		jQ("#friend_smallsharetr").data("round",false);
		jQ("tr.fscrollline").mouseover(function(){
			clearInterval(fscrolllinefun);
		});
		jQ("tr.fscrollline").mouseout(function(){
			clearInterval(fscrolllinefun);
			fscrolllinefun=setInterval(fscrollline,5000);
		});
		fscrolllinefun=setInterval(fscrollline,5000);
	}
}

function fscrollline(){
	
	var max=eval(jQ("#friend_smallsharetr").data("max"));
	var cur=eval(jQ("#friend_smallsharetr").data("cur"));
	var isround=eval(jQ("#friend_smallsharetr").data("round"));
	jQ("tr.fscrollline[linenum=" + cur + "]").fadeOut('slow',function(){
		if(!isround){
			if (cur < max - 3) {
				var temp = cur + 3;
				jQ("tr.fscrollline[linenum=" + temp + "]").fadeIn('normal');
			}else{
				isround=true;
				jQ("#friend_smallsharetr").data("round",true);
				var temp=cur+3-max;
				var obj=jQ("tr.fscrollline[linenum="+temp+"]").clone(true);
				jQ("tr.fscrollline[linenum="+temp+"]").remove();
				jQ("#friend_smallsharetable tr:last").after(obj);
				obj.fadeIn('normal');
			}
		}else{
			var temp;
			if (cur < max - 3) 
				temp=cur+3;
			else
			temp=cur+3-max;
			var obj=jQ("tr.fscrollline[linenum="+temp+"]").clone(true);
			jQ("tr.fscrollline[linenum="+temp+"]").remove();
			jQ("#friend_smallsharetable tr:last").after(obj);
			obj.fadeIn('normal');
		}
		cur++;
		if(cur==max)
			cur=0;
		jQ("#friend_smallsharetr").data("cur",cur);
	});
}

function changeContactType(type){
	if(type!=0&&type!=1){
		return;
	}else{
		window.location.href=jQ("#ctxVal").val()+"/myss/clip_plaza.html?type="+type;
	}
}
*/
function currentMonthClick(){
	jQ("#loadingui").show();
	var tY=eval(jQ("#divtodaydetailtime").data("year"));
	var tM=eval(jQ("#divtodaydetailtime").data("month"));
	jQ("#mouth_fun_view_year option[value='"+tY+"']").attr("selected",true);
	jQ("#mouth_fun_view_month option[value='"+tM+"']").attr("selected",true);
	getUsersShareEventsByMonth(tY, tM);
}
function changeMonthView(){
	jQ("#loadingui").show();
	var year=eval(jQ("#mouth_fun_view_year").val());
	var month=eval(jQ("#mouth_fun_view_month").val());
	getUsersShareEventsByMonth(year, month);
}

function prevYearClick(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	year=year-1;
	var month=eval(jQ("#mouth_fun_view_month").val());
	jQ("#mouth_fun_view_year option[value='"+(year)+"']").attr("selected",true);
	jQ("#mouth_fun_view_year").trigger("change");
}
function prevMonthClick(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	var month=eval(jQ("#mouth_fun_view_month").val());
	if(month==0){
		month=11;
		year=year-1;
	}else{
		month=month-1;
	}
	jQ("#mouth_fun_view_year option[value='"+year+"']").attr("selected",true);
	jQ("#mouth_fun_view_month option[value='"+month+"']").attr("selected",true);
	jQ("#mouth_fun_view_year").trigger("change");
}
function nextMonthClick(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	var month=eval(jQ("#mouth_fun_view_month").val());
	if(month==11){
		month=0;
		year=year+1;
	}else{
		month=month+1;
	}
	jQ("#mouth_fun_view_year option[value='"+year+"']").attr("selected",true);
	jQ("#mouth_fun_view_month option[value='"+month+"']").attr("selected",true);
	jQ("#mouth_fun_view_year").trigger("change");
}
function nextYearClick(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	year=year+1;
	var month=eval(jQ("#mouth_fun_view_month").val());
	jQ("#mouth_fun_view_year option[value='"+(year)+"']").attr("selected",true);
	jQ("#mouth_fun_view_year").trigger("change");
}

function formateDetailTime(daytime){
	var day=new Date();
	day.setTime(daytime);
	return day.pattern("yyyy-MM-dd HH:mm");
}

function formateTitleDetailTime(day){
	return day.pattern("yyyy.MM.dd");
}

function formateSmallDetailTime(day){
	return day.pattern("MMdd");
}

function formateDetailTimeWithouthourmin(daytime){
	var day=new Date();
	day.setTime(daytime);
	return day.pattern("yyyy-MM-dd");
}

function getWordsLength(words,fontsize){
	jQ("#fontwidthtools").css("font-size",fontsize+"px");
	jQ("#fontwidthtools").empty().append(words);
	return jQ("#fontwidthtools")[0].offsetWidth;
}

function formateClockTime(daytime){
	var temp=new Date();
	temp.setTime(daytime);
	return temp.pattern("yyyy年MM月dd日 HH:mm");
}

function resizeImgCSS(img){
	/*var LastestWIDTH=190;
	var LastestHEIGHT=150;*/
    if(typeof(img)!='object')
        img=document.getElementById(img);
    if(img==null)
        return;
    var image=document.createElement("img");
    image.onload=function (){
        var width=this.width;
        var height=this.height;
        if(width<60&&jQ(img).parent().hasClass("bigcursor")){
        	if(jQ(img).parent().hasClass("w_clippic"))
        		jQ(img).parent().removeClass("w_clippic");
        }else{
        	if(!jQ(img).parent().hasClass("w_clippic"))
        		jQ(img).parent().addClass("w_clippic");
        }
        jQ(img).fadeIn();
    };
    image.src=img.src;
}